return bCreatedOK;
}
-BOOL CEditStatusBar::
-SetPaneFormattedText (int nIndex, BOOL bUpdate, LPCTSTR lpszFmt,...)
+bool CEditStatusBar::
+SetPaneFormattedText (int nIndex, bool bUpdate, LPCTSTR lpszFmt,...)
{
TCHAR buffer[256];
va_list argptr;
va_start (argptr, lpszFmt);
_vsntprintf_s (buffer, _TRUNCATE, lpszFmt, argptr);
va_end (argptr);
- BOOL bResult = SetPaneText (nIndex, buffer, bUpdate);
+ bool bResult = SetPaneText (nIndex, buffer, bUpdate);
UpdateWindow ();
return bResult;
}
-BOOL CEditStatusBar::
-SetPaneFormattedText (int nIndex, BOOL bUpdate, UINT nId,...)
+bool CEditStatusBar::
+SetPaneFormattedText (int nIndex, bool bUpdate, UINT nId,...)
{
CString str;
if (str.LoadString (nId))
{
va_list argptr;
va_start (argptr, nId);
- BOOL bResult = SetPaneFormattedText (nIndex, bUpdate, str, argptr);
+ bool bResult = SetPaneFormattedText (nIndex, bUpdate, str, argptr);
va_end (argptr);
return bResult;
}
return false;
}
-BOOL CEditStatusBar::
-SetPaneText (int nIndex, LPCTSTR lpszNewText, BOOL bUpdate /*= true*/ )
+bool CEditStatusBar::
+SetPaneText (int nIndex, LPCTSTR lpszNewText, bool bUpdate /*= true*/ )
{
return CStatusBar::SetPaneText (nIndex, lpszNewText, bUpdate);
}
-BOOL CEditStatusBar::
-SetPaneText (int nIndex, UINT nId, BOOL bUpdate /*= true*/ )
+bool CEditStatusBar::
+SetPaneText (int nIndex, UINT nId, bool bUpdate /*= true*/ )
{
CString str;
if (str.LoadString (nId))
CString m_strClockFormat;
public :
- BOOL SetPaneFormattedText (int nIndex, BOOL bUpdate, LPCTSTR lpszFmt,...);
- BOOL SetPaneFormattedText (int nIndex, BOOL bUpdate, UINT nId,...);
- BOOL SetPaneText (int nIndex, LPCTSTR lpszNewText, BOOL bUpdate = true);
- BOOL SetPaneText (int nIndex, UINT nId, BOOL bUpdate = true);
+ bool SetPaneFormattedText (int nIndex, bool bUpdate, LPCTSTR lpszFmt,...);
+ bool SetPaneFormattedText (int nIndex, bool bUpdate, UINT nId,...);
+ bool SetPaneText (int nIndex, LPCTSTR lpszNewText, bool bUpdate = true);
+ bool SetPaneText (int nIndex, UINT nId, bool bUpdate = true);
void SetClockFormat (LPCTSTR strClockFormat);
// Overrides
try {\r
Merge7z::Format *piHandler = ArchiveGuessFormat(pszFile);\r
if (piHandler)\r
- return TRUE;\r
+ return true;\r
else\r
- return FALSE;\r
+ return false;\r
}\r
catch (CException *e)\r
{\r
e->Delete();\r
- return FALSE;\r
+ return false;\r
}\r
-//~ return FALSE;\r
}\r
\r
/**\r
{\r
// Merge7z has not yet been loaded\r
\r
- if (!GetOptionsMgr()->GetInt(OPT_ARCHIVE_ENABLE))\r
+ if (GetOptionsMgr()->GetInt(OPT_ARCHIVE_ENABLE) == 0)\r
throw new CResourceException();\r
if (DWORD ver = VersionOf7z())\r
{\r
: m_hIdentical(NULL)
, m_hDifferent(NULL)
{
- m_bActivated = FALSE;
+ m_bActivated = false;
std::fill_n(m_nLastSplitPos, 2, 0);
m_pMergeDoc = 0;
}
* The bars are identified with their ID. This means the missing bar bug is triggered
* when we run WinMerge after changing the ID of a bar.
*/
-BOOL CChildFrame::EnsureValidDockState(CDockState& state)
+bool CChildFrame::EnsureValidDockState(CDockState& state)
{
for (int i = (int) state.m_arrBarInfo.GetSize()-1 ; i >= 0; i--)
{
- BOOL barIsCorrect = TRUE;
+ bool barIsCorrect = true;
CControlBarInfo* pInfo = (CControlBarInfo*)state.m_arrBarInfo[i];
if (! pInfo)
- barIsCorrect = FALSE;
+ barIsCorrect = false;
else
{
if (! pInfo->m_bFloating)
{
pInfo->m_pBar = GetControlBar(pInfo->m_nBarID);
if (!pInfo->m_pBar)
- barIsCorrect = FALSE; //toolbar id's probably changed
+ barIsCorrect = false; //toolbar id's probably changed
}
}
if (! barIsCorrect)
state.m_arrBarInfo.RemoveAt(i);
}
- return TRUE;
+ return true;
}
static LRESULT CALLBACK WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
}
else
{
- BOOL bHidden = static_cast<BOOL>(reinterpret_cast<uintptr_t>(RemoveProp(hwnd, _T("Hidden"))));
+ bool bHidden = RemoveProp(hwnd, _T("Hidden")) != nullptr;
if (!bHidden)
::SendMessage(hwnd, WM_SETREDRAW, (WPARAM)lParam, 0);
}
* @brief Alternative LockWindowUpdate(hWnd) API.
* See the comment near the code that calls this function.
*/
-static BOOL MyLockWindowUpdate(HWND hwnd)
+static bool MyLockWindowUpdate(HWND hwnd)
{
WNDPROC pfnOldWndProc;
pfnOldWndProc = (WNDPROC)SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)WndProc);
SetProp(hwnd, _T("OldWndProc"), (HANDLE)pfnOldWndProc);
- return TRUE;
+ return true;
}
/**
* @brief Alternative LockWindowUpdate(NULL) API.
* See the comment near the code that calls this function.
*/
-static BOOL MyUnlockWindowUpdate(HWND hwnd)
+static bool MyUnlockWindowUpdate(HWND hwnd)
{
WNDPROC pfnOldWndProc = (WNDPROC)RemoveProp(hwnd, _T("OldWndProc"));
if (pfnOldWndProc)
EnumChildWindows(hwnd, EnumChildProc, TRUE);
- return TRUE;
+ return true;
}
void CChildFrame::ActivateFrame(int nCmdShow)
if (!m_bActivated)
{
- m_bActivated = TRUE;
+ m_bActivated = true;
// get the active child frame, and a flag whether it is maximized
if (oldActiveFrame == NULL)
// Implementation
private:
- BOOL EnsureValidDockState(CDockState& state);
+ bool EnsureValidDockState(CDockState& state);
void SavePosition();
virtual ~CChildFrame();
CSplitterWndEx& GetMergeEditSplitterWnd(int iRow)
private:
int m_nLastSplitPos[2];
void UpdateHeaderSizes();
- BOOL m_bActivated;
+ bool m_bActivated;
CMergeDoc * m_pMergeDoc;
HICON m_hIdentical;
HICON m_hDifferent;
#error This code does not work on Versions of MFC prior to 4.0
#endif
-BOOL BCMenu::hicolor_bitmaps=FALSE;
+bool BCMenu::hicolor_bitmaps=false;
CImageList BCMenu::m_AllImages;
CArray<int,int&> BCMenu::m_AllImagesID;
static pBGR MyGetDibBits(HDC hdcSrc, HBITMAP hBmpSrc, int nx, int ny)
{
BITMAPINFO bi;
- BOOL bRes;
+ int nRes;
pBGR buf;
bi.bmiHeader.biSize = sizeof(bi.bmiHeader);
bi.bmiHeader.biClrImportant = 0;
buf = (pBGR) malloc(nx * 4 * ny);
- bRes = GetDIBits(hdcSrc, hBmpSrc, 0, ny, buf, &bi, DIB_RGB_COLORS);
- if (!bRes) {
+ nRes = GetDIBits(hdcSrc, hBmpSrc, 0, ny, buf, &bi, DIB_RGB_COLORS);
+ if (nRes == 0) {
free(buf);
- buf = 0;
+ buf = nullptr;
}
return buf;
}
m_szMenuText=NULL;//set to NULL so we need not bother about dangling non-NULL Ptrs
}
-BOOL BCMenu::IsMenu(CMenu *submenu)
+bool BCMenu::IsMenu(CMenu *submenu)
{
return IsMenu(submenu->m_hMenu);
}
-BOOL BCMenu::IsMenu(HMENU submenu)
+bool BCMenu::IsMenu(HMENU submenu)
{
INT_PTR m;
INT_PTR numSubMenus = m_AllSubMenus.GetUpperBound();
}
else{
CRect rect2;
- BOOL standardflag=FALSE,selectedflag=FALSE,disableflag=FALSE;
- BOOL checkflag=FALSE;
+ bool standardflag = false;
+ bool selectedflag = false;
+ bool disableflag = false;
+ bool checkflag=false;
COLORREF crText = GetSysColor(COLOR_MENUTEXT);
int x0,y0,dy;
int nIconNormal=-1;
if(state&ODS_CHECKED && nIconNormal<0){
}
else if(nIconNormal != -1){
- standardflag=TRUE;
- if(state&ODS_SELECTED && !(state&ODS_GRAYED))selectedflag=TRUE;
- else if(state&ODS_GRAYED) disableflag=TRUE;
+ standardflag=true;
+ if(state&ODS_SELECTED && !(state&ODS_GRAYED))selectedflag=true;
+ else if(state&ODS_GRAYED) disableflag=true;
}
}
else{
return(mdata);
};
-BOOL BCMenu::LoadToolbars(const UINT *arID,int n)
+bool BCMenu::LoadToolbars(const UINT *arID,int n)
{
ASSERT(arID);
- BOOL returnflag=TRUE;
+ bool returnflag=true;
for(int i=0;i<n;++i){
- if(!LoadToolbar(arID[i]))returnflag=FALSE;
+ if(!LoadToolbar(arID[i]))returnflag=false;
}
return(returnflag);
}
-BOOL BCMenu::LoadToolbar(UINT nToolBar)
+bool BCMenu::LoadToolbar(UINT nToolBar)
{
- BOOL returnflag=FALSE;
+ bool returnflag=false;
CToolBar bar;
CWnd* pWnd = AfxGetMainWnd();
CImageList imglist;
imglist.Create(m_iconX,m_iconY,ILC_COLORDDB|ILC_MASK,1,1);
if(AddBitmapToImageList(&imglist,nToolBar)){
- returnflag=TRUE;
+ returnflag=true;
for(int i=0;i<bar.GetCount();++i){
UINT nID = bar.GetItemID(i);
if(nID && GetMenuState(nID, MF_BYCOMMAND)
return(returnflag);
}
-BOOL BCMenu::LoadFromToolBar(UINT nID,UINT nToolBar,int& xoffset)
+bool BCMenu::LoadFromToolBar(UINT nID,UINT nToolBar,int& xoffset)
{
// Optimization: avoid creating toolbar window if not needed
HINSTANCE hInst = AfxFindResourceHandle(MAKEINTRESOURCE(nID), RT_TOOLBAR);
HRSRC hRsrc = ::FindResource(hInst, MAKEINTRESOURCE(nID), RT_TOOLBAR);
if (hRsrc == NULL)
- return FALSE;
+ return false;
- BOOL returnflag=FALSE;
+ bool returnflag=false;
CToolBar bar;
CWnd* pWnd = AfxGetMainWnd();
int xset;
bar.GetButtonInfo(offset,nID,nStyle,xset);
if(xset>0)xoffset=xset;
- returnflag=TRUE;
+ returnflag=true;
}
}
return(returnflag);
ddc.SelectObject(pddcOldBmp);
}
-BOOL BCMenu::AddBitmapToImageList(CImageList *bmplist,UINT nResourceID, BOOL bDisabled/*=FALSE*/)
+bool BCMenu::AddBitmapToImageList(CImageList *bmplist,UINT nResourceID, bool bDisabled/*= false*/)
{
- BOOL bReturn=FALSE;
+ bool bReturn=false;
HBITMAP hbmp=LoadSysColorBitmap(nResourceID);
if(hbmp){
if (bDisabled)
GetDisabledBitmap(bmp);
if(m_bitmapBackgroundFlag){
- if(bmplist->Add(&bmp,m_bitmapBackground)>=0)bReturn=TRUE;
+ if(bmplist->Add(&bmp,m_bitmapBackground)>=0)bReturn=true;
}
else{
- if(bmplist->Add(&bmp,GetSysColor(COLOR_3DFACE))>=0)bReturn=TRUE;
+ if(bmplist->Add(&bmp,GetSysColor(COLOR_3DFACE))>=0)bReturn=true;
}
}
else{ // a hicolor bitmap
CBitmap mybmp;
if(mybmp.LoadBitmap(nResourceID)){
- hicolor_bitmaps=TRUE;
+ hicolor_bitmaps=true;
if (bDisabled)
GetDisabledBitmap(mybmp, GetSysColor(COLOR_3DFACE));
else
GetTransparentBitmap(mybmp);
if(m_bitmapBackgroundFlag){
- if(bmplist->Add(&mybmp,m_bitmapBackground)>=0)bReturn=TRUE;
+ if(bmplist->Add(&mybmp,m_bitmapBackground)>=0)bReturn=true;
}
else{
- if(bmplist->Add(&mybmp,GetSysColor(COLOR_3DFACE))>=0)bReturn=TRUE;
+ if(bmplist->Add(&mybmp,GetSysColor(COLOR_3DFACE))>=0)bReturn=true;
}
}
}
// Functions for loading and applying bitmaps to menus (see example application)
virtual BOOL LoadMenu(LPCTSTR lpszResourceName);
virtual BOOL LoadMenu(int nResource);
- BOOL LoadToolbar(UINT nToolBar);
- BOOL LoadToolbars(const UINT *arID,int n);
- BOOL LoadFromToolBar(UINT nID,UINT nToolBar,int& xoffset);
- BOOL AddBitmapToImageList(CImageList *list,UINT nResourceID,BOOL bDisabled=FALSE);
+ bool LoadToolbar(UINT nToolBar);
+ bool LoadToolbars(const UINT *arID,int n);
+ bool LoadFromToolBar(UINT nID,UINT nToolBar,int& xoffset);
+ bool AddBitmapToImageList(CImageList *list,UINT nResourceID,bool bDisabled=false);
static HBITMAP LoadSysColorBitmap(int nResourceId);
// functions for appending a menu option, use the AppendMenu call (see above define)
// Static functions used for handling menu's in the mainframe
static void UpdateMenu(CMenu *pmenu);
- static BOOL IsMenu(CMenu *submenu);
- static BOOL IsMenu(HMENU submenu);
+ static bool IsMenu(CMenu *submenu);
+ static bool IsMenu(HMENU submenu);
static LRESULT FindKeyboardShortcut(UINT nChar,UINT nFlags,CMenu *pMenu);
// Customizing:
static int m_iconY;
COLORREF m_bitmapBackground;
BOOL m_bitmapBackgroundFlag;
- static BOOL hicolor_bitmaps;
+ static bool hicolor_bitmaps;
BOOL m_loadmenu;
static MARGINS m_marginCheck;
static MARGINS m_marginSeparator;
void GrabCurrentDimensionsAsOriginal(HWND hwndParent);
bool DoConstrain(CWnd * pWnd, HWND hwndChild, double fLeftX, double fExpandX, double fAboveY, double fExpandY);
void InitializeChildConstraintData(HWND hwndParent, Constraint & constraint);
- BOOL CheckConstraint(HWND hwndChild);
// handle WM_SIZE
void Resize(HWND hWnd, UINT nType);
// handle WM_GETMINMAXINFO
bool OnTtnNeedText(TOOLTIPTEXT * pTTT, LRESULT * plresult);
bool PaintGrip();
void ClearMostData();
- void DeleteAllConstraints();
// handle WM_DESTROY
void OnDestroy();
* @brief Copies string to clipboard.
* @param [in] text Text to copy to clipboard.
* @param [in] currentWindowHandle Handle to current window.
- * @return TRUE if text copying succeeds, FALSE otherwise.
+ * @return `true` if text copying succeeds, `false` otherwise.
*/
bool PutToClipboard(const String & text, HWND currentWindowHandle)
{
* @brief Retrieves the string from clipboard.
* @param [out] text Text copied from clipboard.
* @param [in] currentWindowHandle Handle to current window.
- * @return TRUE if retrieving the clipboard text succeeds, FALSE otherwise.
+ * @return `true` if retrieving the clipboard text succeeds, `false` otherwise.
*/
bool GetFromClipboard(String & text, HWND currentWindowHandle)
{
/**
* @brief Sets new button color
* @param [in] crlFill New color
- * @param [in] bInvalidate If TRUE button is invalidated (causing redraw)
+ * @param [in] bInvalidate If `true` button is invalidated (causing redraw)
*/
-void CColorButton::SetColor(COLORREF clrFill, BOOL bInvalidate /* = TRUE*/)
+void CColorButton::SetColor(COLORREF clrFill, bool bInvalidate /* = true*/)
{
m_clrFill = clrFill;
if (bInvalidate && m_hWnd)
CColorButton();
explicit CColorButton(COLORREF clrFill);
- void SetColor(COLORREF clrFill, BOOL bInvalidate = TRUE);
+ void SetColor(COLORREF clrFill, bool bInvalidate = true);
COLORREF GetColor() const { return m_clrFill; };
virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
};
/**
* @brief Load language.file
* @param [in] wLangId
- * @return TRUE on success, FALSE otherwise.
+ * @return `true` on success, `false` otherwise.
*/
-BOOL CLanguageSelect::LoadLanguageFile(LANGID wLangId, BOOL bShowError)
+bool CLanguageSelect::LoadLanguageFile(LANGID wLangId, bool bShowError /*= false*/)
{
String strPath = GetFileName(wLangId);
if (strPath.empty())
- return FALSE;
+ return false;
m_hCurrentDll = LoadLibrary(_T("MergeLang.dll"));
// There is no point in translating error messages about inoperational
{
if (bShowError)
AfxMessageBox(_T("Failed to load MergeLang.dll"), MB_ICONSTOP);
- return FALSE;
+ return false;
}
CVersionInfo viInstance(AfxGetInstanceHandle());
unsigned instanceVerMS = 0;
m_hCurrentDll = 0;
if (bShowError)
AfxMessageBox(_T("MergeLang.dll version mismatch"), MB_ICONSTOP);
- return FALSE;
+ return false;
}
HRSRC mergepot = FindResource(m_hCurrentDll, _T("MERGEPOT"), RT_RCDATA);
if (mergepot == 0)
{
if (bShowError)
AfxMessageBox(_T("MergeLang.dll is invalid"), MB_ICONSTOP);
- return FALSE;
+ return false;
}
size_t size = SizeofResource(m_hCurrentDll, mergepot);
const char *data = (const char *)LoadResource(m_hCurrentDll, mergepot);
String str = _T("Failed to load ") + strPath;
AfxMessageBox(str.c_str(), MB_ICONSTOP);
}
- return FALSE;
+ return false;
}
ps = 0;
msgid.erase();
_T("attempting to read translations from\n") + strPath;
AfxMessageBox(str.c_str(), MB_ICONSTOP);
}
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
/**
* @brief Set UI language.
* @param [in] wLangId
- * @return TRUE on success, FALSE otherwise.
+ * @return `true` on success, `false` otherwise.
*/
-BOOL CLanguageSelect::SetLanguage(LANGID wLangId, BOOL bShowError)
+bool CLanguageSelect::SetLanguage(LANGID wLangId, bool bShowError /*= false*/)
{
if (wLangId == 0)
- return FALSE;
+ return false;
if (m_wCurLanguage == wLangId)
- return TRUE;
+ return true;
// reset the resource handle
AfxSetResourceHandle(AfxGetInstanceHandle());
// free the existing DLL
}
m_wCurLanguage = wLangId;
SetThreadLocale(MAKELCID(m_wCurLanguage, SORT_DEFAULT));
- return TRUE;
+ return true;
}
/**
String LoadString(UINT) const;
std::wstring LoadDialogCaption(LPCTSTR lpDialogTemplateID) const;
std::vector<std::pair<LANGID, String> > GetAvailableLanguages() const;
- BOOL SetLanguage(LANGID, BOOL bShowError = FALSE);
+ bool SetLanguage(LANGID, bool bShowError = false);
// Implementation data
private:
// Implementation methods
private:
String GetFileName(LANGID) const;
- BOOL LoadLanguageFile(LANGID, BOOL bShowError = FALSE);
+ bool LoadLanguageFile(LANGID, bool bShowError = false);
};
TC_ITEM tci;
tci.mask = TCIF_PARAM;
GetItem(GetCurSel(), &tci);
- m_bInSelchange = TRUE;
+ m_bInSelchange = true;
m_pMainFrame->MDIActivate(FromHandle((HWND)tci.lParam));
- m_bInSelchange = FALSE;
+ m_bInSelchange = false;
return TRUE;
}
private:
enum {MDITABBAR_MINTITLELENGTH = 8, MDITABBAR_MAXTITLELENGTH = 64};
- BOOL m_bInSelchange;
+ bool m_bInSelchange;
CMDIFrameWnd *m_pMainFrame;
bool m_bMouseTracking;
bool m_bCloseButtonDown;
CFont m_font;
public:
- CMDITabBar() : m_bInSelchange(FALSE), m_pMainFrame(NULL), m_bMouseTracking(false), m_bCloseButtonDown(false), m_bAutoMaxWidth(true), m_nDraggingTabItemIndex(-1) {}
+ CMDITabBar() : m_bInSelchange(false), m_pMainFrame(NULL), m_bMouseTracking(false), m_bCloseButtonDown(false), m_bAutoMaxWidth(true), m_nDraggingTabItemIndex(-1) {}
virtual ~CMDITabBar() {}
BOOL Create(CMDIFrameWnd* pParentWnd);
void UpdateTabs();
// Do the default initialization.
m_hIcon = NULL;
m_nTimeoutSeconds = 0;
- m_bTimeoutDisabled = FALSE;
+ m_bTimeoutDisabled = false;
m_nTimeoutTimer = 0;
m_strRegistryKey = _T("");
m_nDefaultButton = IDC_STATIC;
* screen. All buttons will be disabled, until the countdown is finished.
* After that, the user can click any button.
*/
-void CMessageBoxDialog::SetTimeout ( UINT nSeconds, BOOL bDisabled )
+void CMessageBoxDialog::SetTimeout ( UINT nSeconds, bool bDisabled /*= false*/)
{
// Save the settings for the timeout.
m_nTimeoutSeconds = nSeconds;
/*
* Method for retrieving whether a timeout is disabled.
*/
-inline BOOL CMessageBoxDialog::GetTimeoutDisabled ( )
+inline bool CMessageBoxDialog::GetTimeoutDisabled ( )
{
// Return the flag whether the timeout is disabled.
return m_bTimeoutDisabled;
void CMessageBoxDialog::EndDialog ( int nResult )
{
// Create a variable for storing the state of the checkbox.
- BOOL bDontDisplayAgain = FALSE;
+ bool bDontDisplayAgain = false;
// Try to access the checkbox control.
CWnd* pCheckboxWnd = GetDlgItem(IDCHECKBOX);
* This method adds a button to the list of buttons, which will be created in
* the dialog, but it will not create the button control itself.
*/
-void CMessageBoxDialog::AddButton ( UINT nID, UINT nTitle, BOOL bIsDefault,
- BOOL bIsEscape )
+void CMessageBoxDialog::AddButton ( UINT nID, UINT nTitle, bool bIsDefault /*= false*/,
+ bool bIsEscape /*= false*/ )
{
// Create a new structure to store the button information.
MSGBOXBTN bButton = { nID, nTitle };
HICON GetMessageIcon ( );
// Method for setting a timeout.
- void SetTimeout ( UINT nSeconds, BOOL bDisabled = FALSE );
+ void SetTimeout ( UINT nSeconds, bool bDisabled = false );
// Method for retrieving the seconds for the timeout.
UINT GetTimeoutSeconds ( );
// Method for retrieving whether a timeout is disabled.
- BOOL GetTimeoutDisabled ( );
+ bool GetTimeoutDisabled ( );
// Method for retrieving the former result of the message box from the registry.
int GetFormerResult();
HICON m_hIcon; // Icon to be displayed in the dialog.
UINT m_nTimeoutSeconds; // Seconds for a timeout.
- BOOL m_bTimeoutDisabled; // Flag whether the timeout is disabled.
+ bool m_bTimeoutDisabled; // Flag whether the timeout is disabled.
UINT_PTR m_nTimeoutTimer; // Timer for the timeout.
CString m_strRegistryKey; // Entry for storing the result in the
CString GenerateRegistryKey ( );
// Method for adding a button to the list of buttons.
- void AddButton ( UINT nID, UINT nTitle, BOOL bIsDefault = FALSE,
- BOOL bIsEscape = FALSE );
+ void AddButton ( UINT nID, UINT nTitle, bool bIsDefault = false,
+ bool bIsEscape = false );
// Methods for converting a dialog units to a pixel values.
int XDialogUnitToPixel ( int x );
//////////////////
// Load from resource. Looks for "IMAGE" type.
//
-BOOL CPicture::Load(UINT nIDRes)
+bool CPicture::Load(UINT nIDRes)
{
// find resource in resource file
HINSTANCE hInst = AfxGetInstanceHandle();
MAKEINTRESOURCE(nIDRes),
TEXT("IMAGE")); // type
if (!hRsrc)
- return FALSE;
+ return false;
// load resource into memory
DWORD len = SizeofResource(hInst, hRsrc);
BYTE* lpRsrc = (BYTE*)LoadResource(hInst, hRsrc);
if (!lpRsrc)
- return FALSE;
+ return false;
// create memory file and load it
CMemFile file(lpRsrc, len);
- BOOL bRet = Load(file);
+ bool bRet = Load(file);
FreeResource(hRsrc);
return bRet;
//////////////////
// Load from path name.
//
-BOOL CPicture::Load(LPCTSTR pszPathName)
+bool CPicture::Load(LPCTSTR pszPathName)
{
CFile file;
if (!file.Open(pszPathName, CFile::modeRead|CFile::shareDenyWrite))
- return FALSE;
- BOOL bRet = Load(file);
+ return false;
+ bool bRet = Load(file);
file.Close();
return bRet;
}
//////////////////
// Load from CFile
//
-BOOL CPicture::Load(CFile& file)
+bool CPicture::Load(CFile& file)
{
CArchive ar(&file, CArchive::load | CArchive::bNoFlushOnDelete);
return Load(ar);
// Load from archive--create stream and load from stream.
//
// CArchiveStream Doesn't compile with VS2003.Net
-BOOL CPicture::Load(CArchive& ar)
+bool CPicture::Load(CArchive& ar)
{
CArchiveStream arcstream(&ar);
return Load((IStream*)&arcstream);
// Load from stream (IStream). This is the one that really does it: call
// OleLoadPicture to do the work.
//
-BOOL CPicture::Load(IStream* pstm)
+bool CPicture::Load(IStream* pstm)
{
Free();
HRESULT hr = OleLoadPicture(pstm, 0, FALSE,
IID_IPicture, (void**)&m_spIPicture);
ASSERT(SUCCEEDED(hr) && m_spIPicture);
- return TRUE;
+ return true;
}
//////////////////
// Render to device context. Covert to HIMETRIC for IPicture.
//
-BOOL CPicture::Render(CDC* pDC, CRect rc, LPCRECT prcMFBounds) const
+bool CPicture::Render(CDC* pDC, CRect rc, LPCRECT prcMFBounds) const
{
ASSERT(pDC);
m_spIPicture->Render(*pDC, rc.left, rc.top, rc.Width(), rc.Height(),
0, hmHeight, hmWidth, -hmHeight, prcMFBounds);
- return TRUE;
+ return true;
}
//////////////////
~CPicture();
// Load frm various sosurces
- BOOL Load(UINT nIDRes);
- BOOL Load(LPCTSTR pszPathName);
- BOOL Load(CFile& file);
- BOOL Load(CArchive& ar);
- BOOL Load(IStream* pstm);
+ bool Load(UINT nIDRes);
+ bool Load(LPCTSTR pszPathName);
+ bool Load(CFile& file);
+ bool Load(CArchive& ar);
+ bool Load(IStream* pstm);
// render to device context
- BOOL Render(CDC* pDC, CRect rc=CRect(0,0,0,0),
+ bool Render(CDC* pDC, CRect rc=CRect(0,0,0,0),
LPCRECT prcMFBounds=NULL) const;
CSize GetImageSize(CDC* pDC=NULL) const;
void CPreferencesDlg::OnImportButton()
{
String s;
- if (SelectFile(GetSafeHwnd(), s, TRUE, NULL, _("Select file for import"), _("Options files (*.ini)|*.ini|All Files (*.*)|*.*||")))
+ if (SelectFile(GetSafeHwnd(), s, true, NULL, _("Select file for import"), _("Options files (*.ini)|*.ini|All Files (*.*)|*.*||")))
{
if (m_pOptionsMgr->ImportOptions(s) == COption::OPT_OK)
{
Options::SyntaxColors::Load(m_pOptionsMgr, m_pSyntaxColors);
- ReadOptions(TRUE);
+ ReadOptions(true);
LangMessageBox(IDS_OPT_IMPORT_DONE, MB_ICONINFORMATION);
}
else
void CPreferencesDlg::OnExportButton()
{
String settingsFile;
- if (SelectFile(GetSafeHwnd(), settingsFile, FALSE, NULL, _("Select file for export"),
+ if (SelectFile(GetSafeHwnd(), settingsFile, false, NULL, _("Select file for export"),
_("Options files (*.ini)|*.ini|All Files (*.*)|*.*||")))
{
// Add settings file extension if it is missing
return pActive ? (LRESULT)pActive->GetSafeHwnd() : NULL;
}
-BOOL CPropertyPageHost::SetActivePage(int nIndex, BOOL bAndFocus)
+bool CPropertyPageHost::SetActivePage(int nIndex, bool bAndFocus /*= true*/)
{
if (nIndex < 0 || nIndex >= m_aPages.GetSize())
return FALSE;
pFocus->SetFocus();
m_nSelIndex = nIndex;
- return TRUE;
+ return true;
}
-BOOL CPropertyPageHost::SetActivePage(CPropertyPage* pPage, BOOL bAndFocus)
+bool CPropertyPageHost::SetActivePage(CPropertyPage* pPage, bool bAndFocus /*= true*/)
{
return SetActivePage(FindPage(pPage));
}
-BOOL CPropertyPageHost::AddPage(CPropertyPage* pPage, LPCTSTR szTitle, DWORD dwItemData)
+bool CPropertyPageHost::AddPage(CPropertyPage* pPage, LPCTSTR szTitle, DWORD dwItemData)
{
if (!pPage || !pPage->IsKindOf(RUNTIME_CLASS(CPropertyPage)))
return FALSE;
int GetActiveIndex();
CPropertyPage* GetActivePage();
- BOOL AddPage(CPropertyPage* pPage, LPCTSTR szTitle = NULL, DWORD dwItemData = 0);
- BOOL SetActivePage(int nIndex, BOOL bAndFocus = TRUE);
- BOOL SetActivePage(CPropertyPage* pPage, BOOL bAndFocus = TRUE);
+ bool AddPage(CPropertyPage* pPage, LPCTSTR szTitle = NULL, DWORD dwItemData = 0);
+ bool SetActivePage(int nIndex, bool bAndFocus = true);
+ bool SetActivePage(CPropertyPage* pPage, bool bAndFocus = true);
int GetPageCount() { return (int) m_aPages.GetSize(); }
CString GetPageTitle(int nIndex);
DWORD GetPageItemData(int nIndex);
}
/**
- * @brief Write BOOL value to registry.
+ * @brief Write `bool` value to registry.
* @param [in] pszKey Path to actual registry key to access.
* @param [in] bVal Value to write.
* @return ERROR_SUCCESS on success, or error value.
*/
-LONG CRegKeyEx::WriteBool(LPCTSTR pszKey, BOOL bVal)
+LONG CRegKeyEx::WriteBool(LPCTSTR pszKey, bool bVal)
{
assert(m_hKey);
assert(pszKey);
}
/**
- * @brief Read BOOL value from registry.
+ * @brief Read `bool` value from registry.
* @param [in] pszKey Path to actual registry key to access.
* @param [in] defval Default value to return if reading fails.
- * @return Read BOOL value.
+ * @return Read `bool` value.
*/
-BOOL CRegKeyEx::ReadBool(LPCTSTR pszKey, BOOL defval)
+bool CRegKeyEx::ReadBool(LPCTSTR pszKey, bool defval)
{
assert(m_hKey);
assert(pszKey);
LONG WriteDword (LPCTSTR pszKey, DWORD dwVal);
LONG WriteString (LPCTSTR pszKey, LPCTSTR pszVal);
- LONG WriteBool (LPCTSTR pszKey, BOOL bVal);
+ LONG WriteBool (LPCTSTR pszKey, bool bVal);
LONG WriteFloat (LPCTSTR pszKey, float fVal);
DWORD ReadDword (LPCTSTR pszKey, DWORD defval);
float ReadFloat (LPCTSTR pszKey, float defval);
- BOOL ReadBool(LPCTSTR pszKey, BOOL defval);
+ bool ReadBool(LPCTSTR pszKey, bool defval);
LONG ReadLong (LPCTSTR pszKey, LONG defval);
UINT ReadUint (LPCTSTR pszKey, UINT defval);
UINT ReadInt (LPCTSTR pszKey, int defval);
strVal = value.GetString();
}
- BOOL bRet = WritePrivateProfileString(_T("WinMerge"), name.c_str(),
+ bool bRet = !!WritePrivateProfileString(_T("WinMerge"), name.c_str(),
strVal.c_str(), filename.c_str());
if (!bRet)
retVal = COption::OPT_ERR;
varprop::VariantValue value = Get(pKey);
if (value.GetType() == varprop::VT_BOOL)
{
- BOOL boolVal = GetPrivateProfileInt(_T("WinMerge"), pKey, 0, filename.c_str());
- value.SetBool(boolVal == 1);
- SaveOption(pKey, boolVal == 1);
+ bool boolVal = GetPrivateProfileInt(_T("WinMerge"), pKey, 0, filename.c_str()) == 1;
+ value.SetBool(boolVal);
+ SaveOption(pKey, boolVal);
}
else if (value.GetType() == varprop::VT_INT)
{
if (ret == 0x75) // DE_OPCANCELLED
m_isCanceled = true;
- BOOL anyAborted = fileop.fAnyOperationsAborted;
+ bool anyAborted = !!fileop.fAnyOperationsAborted;
// SHFileOperation returns 0 when succeeds
- if (ret == 0 && anyAborted == FALSE)
+ if (ret == 0 && !anyAborted)
return true;
return false;
}
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
-CSortHeaderCtrl::CSortHeaderCtrl() : m_bSortAsc(TRUE), m_nSortCol(-1)
+CSortHeaderCtrl::CSortHeaderCtrl() : m_bSortAsc(true), m_nSortCol(-1)
{
}
{
}
-int CSortHeaderCtrl::SetSortImage(int nCol, BOOL bAsc)
+int CSortHeaderCtrl::SetSortImage(int nCol, bool bAsc)
{
int nPrevCol = m_nSortCol;
// Attributes
protected:
int m_nSortCol;
- BOOL m_bSortAsc;
+ bool m_bSortAsc;
// Operations
public:
//{{AFX_VIRTUAL(CSortHeaderCtrl)
//}}AFX_VIRTUAL
- virtual int SetSortImage(int nCol, BOOL bAsc);
+ virtual int SetSortImage(int nCol, bool bAsc);
// Implementation
public:
CSplitterWndEx::CSplitterWndEx()
{
- m_bBarLocked = FALSE;
- m_bResizePanes = FALSE;
- m_bAutoResizePanes = FALSE;
- m_bHideBorders = FALSE;
+ m_bBarLocked = false;
+ m_bResizePanes = false;
+ m_bAutoResizePanes = false;
+ m_bHideBorders = false;
}
CSplitterWndEx::~CSplitterWndEx()
std::vector<CWnd *> pColPanes(nCols);
std::vector<CWnd *> pRowPanes(nRows);
- BOOL bHasVScroll = m_bHasHScroll;
- BOOL bHasHScroll = m_bHasVScroll;
+ bool bHasVScroll = m_bHasHScroll;
+ bool bHasHScroll = m_bHasVScroll;
CScrollBar *pBar;
int pane;
public:
CSplitterWndEx();
virtual ~CSplitterWndEx();
- void LockBar(BOOL bState=TRUE){m_bBarLocked=bState;};
- void ResizablePanes(BOOL bState=TRUE){m_bResizePanes=bState;};
- void AutoResizePanes(BOOL bState=TRUE){m_bAutoResizePanes=bState;};
- void HideBorders(BOOL bHide)
+ void LockBar(bool bState=true){m_bBarLocked=bState;};
+ void ResizablePanes(bool bState=true){m_bResizePanes=bState;};
+ void AutoResizePanes(bool bState=true){m_bAutoResizePanes=bState;};
+ void HideBorders(bool bHide)
{
m_cxBorder = m_cyBorder = bHide ? 0 : 2;
m_bHideBorders = bHide;
CScrollBar* GetScrollBarCtrl(CWnd* pWnd, int nBar) const;
private:
- BOOL m_bBarLocked;
- BOOL m_bResizePanes;
- BOOL m_bAutoResizePanes;
- BOOL m_bHideBorders;
+ bool m_bBarLocked;
+ bool m_bResizePanes;
+ bool m_bAutoResizePanes;
+ bool m_bHideBorders;
protected:
afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
/**
* @brief Read one (DOS or UNIX or Mac) line. Do not include eol chars.
* @param [out] line Line read.
- * @param [out] lossy TRUE if there were lossy encoding.
- * @return TRUE if there is more lines to read, TRUE when last line is read.
+ * @param [out] lossy `true` if there were lossy encoding.
+ * @return `true` if there is more lines to read, `false` when last line is read.
*/
bool UniMemFile::ReadString(String & line, bool * lossy)
{
* not several strings there are. This saves some time.
* @param [in] bVersionOnly If TRUE only version numbers are read.
*/
-CVersionInfo::CVersionInfo(BOOL bVersionOnly)
+CVersionInfo::CVersionInfo(bool bVersionOnly)
: m_wLanguage(0)
, m_bVersionOnly(bVersionOnly)
-, m_bDllVersion(FALSE)
+, m_bDllVersion(false)
{
GetVersionInfo();
}
*/
CVersionInfo::CVersionInfo(WORD wLanguage)
: m_wLanguage(wLanguage)
-, m_bVersionOnly(FALSE)
-, m_bDllVersion(FALSE)
+, m_bVersionOnly(false)
+, m_bDllVersion(false)
{
GetVersionInfo();
}
* @param [in] bDllVersion If TRUE queries DLL version.
*/
CVersionInfo::CVersionInfo(LPCTSTR szFileToVersion,
- BOOL bDllVersion)
+ bool bDllVersion)
: m_wLanguage(0)
-, m_bVersionOnly(FALSE)
+, m_bVersionOnly(false)
, m_bDllVersion(bDllVersion)
{
if (szFileToVersion != NULL)
LPCTSTR szLanguage /* = NULL*/,
LPCTSTR szCodepage /* = NULL*/)
: m_wLanguage(0)
-, m_bVersionOnly(FALSE)
-, m_bDllVersion(FALSE)
+, m_bVersionOnly(false)
+, m_bDllVersion(false)
{
if (szFileToVersion != NULL)
m_strFileName = szFileToVersion;
*/
CVersionInfo::CVersionInfo(HINSTANCE hModule)
: m_wLanguage(0)
-, m_bVersionOnly(FALSE)
-, m_bDllVersion(FALSE)
+, m_bVersionOnly(false)
+, m_bDllVersion(false)
{
TCHAR szFileName[MAX_PATH];
GetModuleFileName(hModule, szFileName, MAX_PATH);
* This function returns version number given as two DWORDs.
* @param [out] versionMS High DWORD for version number.
* @param [out] versionLS Low DWORD for version number.
- * @return TRUE if version info was found, FALSE otherwise.
+ * @return `true` if version info was found, `false` otherwise.
*/
-BOOL CVersionInfo::GetFixedFileVersion(unsigned& versionMS, unsigned& versionLS)
+bool CVersionInfo::GetFixedFileVersion(unsigned& versionMS, unsigned& versionLS)
{
if (m_bVersionFound)
{
versionMS = m_FixedFileInfo.dwFileVersionMS;
versionLS = m_FixedFileInfo.dwFileVersionLS;
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
/**
DWORD dwVerInfoSize = ::GetFileVersionInfoSize(szFileName, &dwVerHnd);
if (dwVerInfoSize)
{
- m_bVersionFound = TRUE;
+ m_bVersionFound = true;
m_pVffInfo.reset(new BYTE[dwVerInfoSize]);
if (::GetFileVersionInfo(szFileName, 0, dwVerInfoSize, m_pVffInfo.get()))
{
GetFixedVersionInfo();
- if (m_bVersionOnly == FALSE)
+ if (!m_bVersionOnly)
QueryStrings();
}
}
assert(m_pVffInfo != NULL);
LPTSTR lpVersion; // String pointer to 'version' text
UINT uVersionLen;
- BOOL bRetCode;
+ bool bRetCode;
TCHAR szSelector[256];
StringCchPrintf(szSelector, countof(szSelector) - 1,
{
VS_FIXEDFILEINFO * pffi;
UINT len = sizeof(*pffi);
- BOOL bRetCode = VerQueryValue(
+ bool bRetCode = VerQueryValue(
(LPVOID)m_pVffInfo.get(), _T("\\"), (LPVOID *)&pffi, &len);
if (bRetCode)
m_FixedFileInfo = *pffi;
* find existing version info data.
* @param [in] wLanguage Language ID for which we need matching codepage.
* @param [out] wCodePage Found codepage.
- * @return TRUE if language was found from version info block.
+ * @return `true` if language was found from version info block.
*/
-BOOL CVersionInfo::GetCodepageForLanguage(WORD wLanguage, WORD & wCodePage)
+bool CVersionInfo::GetCodepageForLanguage(WORD wLanguage, WORD & wCodePage)
{
LANGUAGEANDCODEPAGE *lpTranslate;
UINT cbTranslate;
const int nLangCount = cbTranslate / sizeof(LANGUAGEANDCODEPAGE);
int i = 0;
- BOOL bFound = FALSE;
- while (bFound == FALSE && i < nLangCount)
+ bool bFound = false;
+ while (!bFound && i < nLangCount)
{
if (lpTranslate[i].wLanguage == wLanguage)
{
wCodePage = lpTranslate[i].wCodePage;
- bFound = TRUE;
+ bFound = true;
}
else
++i;
* @brief Class providing access to version information of a file.
* This class reads version information block from a file. Version information
* consists of version numbers, copyright, descriptions etc. Since that is
- * many strings to read, there is constructor taking BOOL parameter and
+ * many strings to read, there is constructor taking `bool` parameter and
* only reading version numbers. That constructor is suggested to be used
* if string information is not needed.
*/
private:
VS_FIXEDFILEINFO m_FixedFileInfo; /**< Fixed file information */
std::unique_ptr<BYTE[]> m_pVffInfo; /**< Pointer to version information block */
- BOOL m_bVersionOnly; /**< Ask version numbers only */
- BOOL m_bDllVersion; /**< Dll file version is being queried */
+ bool m_bVersionOnly; /**< Ask version numbers only */
+ bool m_bDllVersion; /**< Dll file version is being queried */
WORD m_wLanguage; /**< Language-ID to use (if given) */
- BOOL m_bVersionFound; /**< Was version info found from file? */
+ bool m_bVersionFound; /**< Was version info found from file? */
String m_strFileName;
String m_strLanguage;
String m_strPrivateBuild;
public:
- explicit CVersionInfo(BOOL bVersionOnly);
+ explicit CVersionInfo(bool bVersionOnly);
explicit CVersionInfo(WORD wLanguage);
CVersionInfo(LPCTSTR szFileToVersion,
- BOOL bDllVersion);
+ bool bDllVersion);
CVersionInfo(LPCTSTR szFileToVersion = NULL,
LPCTSTR szLanguage = NULL,
LPCTSTR szCodepage = NULL);
String GetFixedProductVersion();
String GetFixedFileVersion();
DLLVERSIONINFO m_dvi;
- BOOL GetFixedFileVersion(unsigned& versionMS, unsigned& versionLS);
+ bool GetFixedFileVersion(unsigned& versionMS, unsigned& versionLS);
protected:
void GetVersionInfo();
void GetFixedVersionInfo();
void QueryStrings();
void QueryValue(LPCTSTR szId, String& s);
- BOOL GetCodepageForLanguage(WORD wLanguage, WORD & wCodePage);
+ bool GetCodepageForLanguage(WORD wLanguage, WORD & wCodePage);
};
-/* File: lwdisp.c - light weight dispatch API
+/* File: lwdisp.h - light weight dispatch API
* Author: Jochen Tucht 2003/01/09
* Copyright (C) 2003 herbert dahm datensysteme GmbH
*
CBitmap* m_oldBitmap; // bitmap originally found in CMemDC
CDC* m_pDC; // Saves CDC passed in constructor
CRect m_rect; // Rectangle of drawing area.
- BOOL m_bMemDC; // TRUE if CDC really is a Memory DC.
+ bool m_bMemDC; // `true` if CDC really is a Memory DC.
public:
CMyMemDC(CDC* pDC, const CRect* pRect = NULL) : CDC()
/// return number of valid transformation until now
int & GetNChangedValid() { return m_nChangedValid; }
/// return format of original data
- int GetOriginalMode() const { return m_bOriginalIsUnicode; }
+ bool GetOriginalMode() const { return m_bOriginalIsUnicode; }
private:
void Initialize();
// Implementation data
private:
// original data mode ANSI/UNICODE
- int m_bOriginalIsUnicode;
+ bool m_bOriginalIsUnicode;
// current format of data : BUFFER/FILE, ANSI/UNICODE
bool m_bCurrentIsUnicode;
CSizingControlBarCF::CSizingControlBarCF()
{
- m_bActive = FALSE;
+ m_bActive = false;
CDC dc;
dc.CreateCompatibleDC(NULL);
if (!HasGripper())
return;
- BOOL bNeedPaint = FALSE;
+ bool bNeedPaint = false;
CWnd* pFocus = GetFocus();
- BOOL bActiveOld = m_bActive;
+ bool bActiveOld = m_bActive;
m_bActive = (pFocus->GetSafeHwnd() && IsChild(pFocus));
if (m_bActive != bActiveOld)
- bNeedPaint = TRUE;
+ bNeedPaint = true;
if (bNeedPaint)
SendMessage(WM_NCPAINT);
return;
// compute the caption rectangle
- BOOL bHorz = IsHorzDocked();
+ bool bHorz = IsHorzDocked();
CRect rcGrip = rcClient;
const int lpx = pDC->GetDeviceCaps(LOGPIXELSX);
auto pointToPixel = [lpx](double point) { return static_cast<int>(point * lpx / 72); };
// draw the caption text - first select a font
CFont font;
LOGFONT lf;
- BOOL bFont = font.CreatePointFont(85/*8.5 points*/, m_sFontFace);
+ bool bFont = !!font.CreatePointFont(85/*8.5 points*/, m_sFontFace);
if (bFont)
{
// get the text color
virtual void NcPaintGripper(CDC* pDC, CRect rcClient);
protected:
- BOOL m_bActive; // a child has focus
+ bool m_bActive; // a child has focus
CString m_sFontFace;
// Generated message map functions
CRect rc(pRc); // the client rect as calculated by the base class
- BOOL bHorz = (nDockBarID == AFX_IDW_DOCKBAR_TOP) ||
+ bool bHorz = (nDockBarID == AFX_IDW_DOCKBAR_TOP) ||
(nDockBarID == AFX_IDW_DOCKBAR_BOTTOM);
const int lpx = CClientDC(this).GetDeviceCaps(LOGPIXELSX);
auto pointToPixel = [lpx](double point) { return static_cast<int>(point * lpx / 72); };
CRect gripper = rcClient;
CRect rcbtn(m_biHide.ptOrg, CSize(pointToPixel(m_biHide.dblBoxSize), pointToPixel(m_biHide.dblBoxSize)));
- BOOL bHorz = IsHorzDocked();
+ bool bHorz = IsHorzDocked();
gripper.DeflateRect(1, 1);
if (bHorz)
if (!HasGripper())
return;
- BOOL bNeedPaint = FALSE;
+ bool bNeedPaint = false;
CPoint pt;
::GetCursorPos(&pt);
- BOOL bHit = (OnNcHitTest(pt) == HTCLOSE);
- BOOL bLButtonDown = (::GetKeyState(VK_LBUTTON) < 0);
+ bool bHit = (OnNcHitTest(pt) == HTCLOSE);
+ bool bLButtonDown = (::GetKeyState(VK_LBUTTON) < 0);
- BOOL bWasPushed = m_biHide.bPushed;
+ bool bWasPushed = m_biHide.bPushed;
m_biHide.bPushed = bHit && bLButtonDown;
- BOOL bWasRaised = m_biHide.bRaised;
+ bool bWasRaised = m_biHide.bRaised;
m_biHide.bRaised = bHit && !bLButtonDown;
bNeedPaint |= (m_biHide.bPushed ^ bWasPushed) ||
CSCBButton::CSCBButton()
{
- bRaised = FALSE;
- bPushed = FALSE;
+ bRaised = false;
+ bPushed = false;
}
void CSCBButton::Paint(CDC* pDC)
pDC->SetTextColor(clrOldTextColor);
}
-BOOL CSizingControlBarG::HasGripper() const
+bool CSizingControlBarG::HasGripper() const
{
#if defined(_SCB_MINIFRAME_CAPTION) || !defined(_SCB_REPLACE_MINIFRAME)
// if the miniframe has a caption, don't display the gripper
if (IsFloating())
- return FALSE;
+ return false;
#endif //_SCB_MINIFRAME_CAPTION
- return TRUE;
+ return true;
}
void Move(CPoint ptTo) {ptOrg = ptTo; };
void Paint(CDC* pDC);
- BOOL bPushed;
- BOOL bRaised;
+ bool bPushed;
+ bool bRaised;
const double dblBoxSize = 8.25;
CPoint ptOrg;
};
// Attributes
public:
- virtual BOOL HasGripper() const;
+ virtual bool HasGripper() const;
// Operations
public:
m_szHorz = CSize(120, 200);
m_szVert = CSize(120, 200);
m_szFloat = CSize(120, 200);
- m_bTracking = FALSE;
- m_bKeepSize = FALSE;
- m_bParentSizing = FALSE;
+ m_bTracking = false;
+ m_bKeepSize = false;
+ m_bParentSizing = false;
m_cxEdge = 5;
- m_bDragShowContent = FALSE;
+ m_bDragShowContent = false;
m_nDockBarID = 0;
m_dwSCBStyle = 0;
m_htEdge = 0;
// old creation method, still here for compatibility reasons
BOOL CSizingControlBar::Create(LPCTSTR lpszWindowName, CWnd* pParentWnd,
- CSize sizeDefault, BOOL bHasGripper,
+ CSize sizeDefault, bool bHasGripper,
UINT nID, DWORD dwStyle)
{
UNUSED_ALWAYS(bHasGripper);
// query SPI_GETDRAGFULLWINDOWS system parameter
// OnSettingChange() will update m_bDragShowContent
- m_bDragShowContent = FALSE;
+ m_bDragShowContent = false;
::SystemParametersInfo(SPI_GETDRAGFULLWINDOWS, 0,
&m_bDragShowContent, 0);
return lResult;
}
-const BOOL CSizingControlBar::IsFloating() const
+const bool CSizingControlBar::IsFloating() const
{
return !IsHorzDocked() && !IsVertDocked();
}
-const BOOL CSizingControlBar::IsHorzDocked() const
+const bool CSizingControlBar::IsHorzDocked() const
{
return (m_nDockBarID == AFX_IDW_DOCKBAR_TOP ||
m_nDockBarID == AFX_IDW_DOCKBAR_BOTTOM);
}
-const BOOL CSizingControlBar::IsVertDocked() const
+const bool CSizingControlBar::IsVertDocked() const
{
return (m_nDockBarID == AFX_IDW_DOCKBAR_LEFT ||
m_nDockBarID == AFX_IDW_DOCKBAR_RIGHT);
}
-const BOOL CSizingControlBar::IsSideTracking() const
+const bool CSizingControlBar::IsSideTracking() const
{
// don't call this when not tracking
ASSERT(m_bTracking && !IsFloating());
if (IsVisible() && !IsFloating() &&
m_bParentSizing && arrSCBars[0] == this)
- if (NegotiateSpace(nLengthTotal, (bHorz != FALSE)))
+ if (NegotiateSpace(nLengthTotal, (!!bHorz)))
AlignControlBars();
- m_bParentSizing = FALSE;
+ m_bParentSizing = false;
if (bHorz)
return CSize(max(m_szMinHorz.cx, m_szHorz.cx),
if (dwMode & (LM_HORZDOCK | LM_VERTDOCK)) // docked ?
{
if (nLength == -1)
- m_bParentSizing = TRUE;
+ m_bParentSizing = true;
return baseCSizingControlBar::CalcDynamicLayout(nLength, dwMode);
}
if (!IsFloating())
if (lpwndpos->flags & SWP_SHOWWINDOW)
- m_bKeepSize = TRUE;
+ m_bKeepSize = true;
}
/////////////////////////////////////////////////////////////////////////
int nThis;
GetRowSizingBars(arrSCBars, nThis);
- BOOL bHorz = IsHorzDocked();
+ bool bHorz = IsHorzDocked();
if (nThis > 0)
m_dwSCBStyle |= bHorz ? SCBS_EDGELEFT : SCBS_EDGETOP;
{
baseCSizingControlBar::OnSettingChange(uFlags, lpszSection);
- m_bDragShowContent = FALSE;
+ m_bDragShowContent = false;
::SystemParametersInfo(SPI_GETDRAGFULLWINDOWS, 0,
&m_bDragShowContent, 0); // update
}
RedrawWindow(NULL, NULL, RDW_ALLCHILDREN | RDW_UPDATENOW);
m_htEdge = nHitTest;
- m_bTracking = TRUE;
+ m_bTracking = true;
- BOOL bHorz = IsHorzDocked();
- BOOL bHorzTracking = m_htEdge == HTLEFT || m_htEdge == HTRIGHT;
+ bool bHorz = IsHorzDocked();
+ bool bHorzTracking = m_htEdge == HTLEFT || m_htEdge == HTRIGHT;
m_nTrackPosOld = bHorzTracking ? point.x : point.y;
reposQuery, &rcT, NULL, TRUE);
int nMaxWidth = bHorz ? rcT.Height() - 2 : rcT.Width() - 2;
- BOOL bTopOrLeft = m_htEdge == HTTOP || m_htEdge == HTLEFT;
+ bool bTopOrLeft = m_htEdge == HTTOP || m_htEdge == HTLEFT;
m_nTrackPosMin -= bTopOrLeft ? nMaxWidth : nExcessWidth;
m_nTrackPosMax += bTopOrLeft ? nExcessWidth : nMaxWidth;
{
OnTrackInvertTracker(); // erase tracker
- m_bTracking = FALSE;
+ m_bTracking = false;
ReleaseCapture();
m_pDockSite->DelayRecalcLayout();
{
ASSERT(!IsFloating());
- BOOL bHorzTrack = m_htEdge == HTLEFT || m_htEdge == HTRIGHT;
+ bool bHorzTrack = m_htEdge == HTLEFT || m_htEdge == HTRIGHT;
int nTrackPos = bHorzTrack ? point.x : point.y;
nTrackPos = max(m_nTrackPosMin, min(m_nTrackPosMax, nTrackPos));
m_nTrackPosOld = nTrackPos;
- BOOL bHorz = IsHorzDocked();
+ bool bHorz = IsHorzDocked();
CSize sizeNew = bHorz ? m_szHorz : m_szVert;
switch (m_htEdge)
else
{
int nGrowingBar = nThis;
- BOOL bBefore = m_htEdge == HTTOP || m_htEdge == HTLEFT;
+ bool bBefore = m_htEdge == HTTOP || m_htEdge == HTLEFT;
if (bBefore && nDelta > 0)
nGrowingBar--;
if (!bBefore && nDelta < 0)
if (m_bDragShowContent)
return; // don't show tracker if DragFullWindows is on
- BOOL bHorz = IsHorzDocked();
+ bool bHorz = IsHorzDocked();
CRect rc, rcBar, rcDock, rcFrame;
GetWindowRect(rcBar);
m_pDockBar->GetWindowRect(rcDock);
CRect(rcDock.left + 1, rc.top, rcDock.right - 1, rc.bottom) :
CRect(rc.left, rcDock.top + 1, rc.right, rcDock.bottom - 1);
- BOOL bHorzTracking = m_htEdge == HTLEFT || m_htEdge == HTRIGHT;
+ bool bHorzTracking = m_htEdge == HTLEFT || m_htEdge == HTRIGHT;
int nOfs = m_nTrackPosOld - m_nTrackEdgeOfs;
nOfs -= bHorzTracking ? rc.CenterPoint().x : rc.CenterPoint().y;
rc.OffsetRect(bHorzTracking ? nOfs : 0, bHorzTracking ? 0 : nOfs);
m_pDockSite->ReleaseDC(pDC);
}
-BOOL CSizingControlBar::GetEdgeRect(CRect rcWnd, UINT nHitTest,
+bool CSizingControlBar::GetEdgeRect(CRect rcWnd, UINT nHitTest,
CRect& rcEdge)
{
rcEdge = rcWnd;
if (m_dwSCBStyle & SCBS_SHOWEDGES)
rcEdge.DeflateRect(1, 1);
- BOOL bHorz = IsHorzDocked();
+ bool bHorz = IsHorzDocked();
switch (nHitTest)
{
}
}
-BOOL CSizingControlBar::NegotiateSpace(int nLengthTotal, BOOL bHorz)
+bool CSizingControlBar::NegotiateSpace(int nLengthTotal, bool bHorz)
{
ASSERT(bHorz == IsHorzDocked());
pBar = static_cast<CSizingControlBar*>(m_pDockBar->m_arrBars[i]);
if (HIWORD(pBar) == 0) continue; // placeholder
if (!pBar->IsVisible()) continue;
- BOOL bIsSizingBar =
+ bool bIsSizingBar =
pBar->IsKindOf(RUNTIME_CLASS(CSizingControlBar));
int nLengthBar; // minimum length of the bar
{
m_pDockBar->m_arrBars.InsertAt(i + 1,
(CControlBar*) NULL);
- return FALSE;
+ return false;
}
// only this sizebar remains on the row, adjust it to minsize
else
m_szVert.cy = m_szMinVert.cy;
- return TRUE; // the dockbar will split the row for us
+ return true; // the dockbar will split the row for us
}
// we have enough bars - go negotiate with them
ASSERT(arrSCBars[0] == this);
if (nDelta == 0)
- return TRUE;
+ return true;
- m_bKeepSize = FALSE;
+ m_bKeepSize = false;
(bHorz ? m_szHorz.cx : m_szVert.cy) += nDelta;
- return TRUE;
+ return true;
}
// make all the bars the same width
// clear m_bKeepSize flags
if ((nDeltaOld == nDelta) || (nDelta == 0))
for (i = 0; i < nNumBars; i++)
- arrSCBars[i]->m_bKeepSize = FALSE;
+ arrSCBars[i]->m_bKeepSize = false;
}
- return TRUE;
+ return true;
}
void CSizingControlBar::AlignControlBars()
int nFirst, nLast, nThis;
GetRowInfo(nFirst, nLast, nThis);
- BOOL bHorz = IsHorzDocked();
- BOOL bNeedRecalc = FALSE;
+ bool bHorz = IsHorzDocked();
+ bool bNeedRecalc = false;
int nAlign = bHorz ? -2 : 0;
CRect rc, rcDock;
else
rc.OffsetRect(nAlign - rc.left, 0);
pBar->MoveWindow(rc);
- bNeedRecalc = TRUE;
+ bNeedRecalc = true;
}
nAlign += (bHorz ? rc.Width() : rc.Height()) - 2;
}
CSizingControlBar();
virtual BOOL Create(LPCTSTR lpszWindowName, CWnd* pParentWnd,
- CSize sizeDefault, BOOL bHasGripper,
+ CSize sizeDefault, bool bHasGripper,
UINT nID, DWORD dwStyle = WS_CHILD | WS_VISIBLE | CBRS_TOP);
virtual BOOL Create(LPCTSTR lpszWindowName, CWnd* pParentWnd,
UINT nID, DWORD dwStyle = WS_CHILD | WS_VISIBLE | CBRS_TOP);
// Attributes
public:
- const BOOL IsFloating() const;
- const BOOL IsHorzDocked() const;
- const BOOL IsVertDocked() const;
- const BOOL IsSideTracking() const;
- const BOOL GetSCBStyle() const {return m_dwSCBStyle;}
+ const bool IsFloating() const;
+ const bool IsHorzDocked() const;
+ const bool IsVertDocked() const;
+ const bool IsSideTracking() const;
+ const bool GetSCBStyle() const {return (m_dwSCBStyle != 0);}
// Operations
public:
protected:
// implementation helpers
UINT GetEdgeHTCode(int nEdge);
- BOOL GetEdgeRect(CRect rcWnd, UINT nHitTest, CRect& rcEdge);
+ bool GetEdgeRect(CRect rcWnd, UINT nHitTest, CRect& rcEdge);
virtual void StartTracking(UINT nHitTest, CPoint point);
virtual void StopTracking();
virtual void OnTrackUpdateSize(CPoint& point);
void GetRowInfo(int& nFirst, int& nLast, int& nThis);
void GetRowSizingBars(CSCBArray& arrSCBars);
void GetRowSizingBars(CSCBArray& arrSCBars, int& nThis);
- BOOL NegotiateSpace(int nLengthTotal, BOOL bHorz);
+ bool NegotiateSpace(int nLengthTotal, bool bHorz);
protected:
DWORD m_dwSCBStyle;
int m_nTrackPosMax;
int m_nTrackPosOld;
int m_nTrackEdgeOfs;
- BOOL m_bTracking;
- BOOL m_bKeepSize;
- BOOL m_bParentSizing;
- BOOL m_bDragShowContent;
+ bool m_bTracking;
+ bool m_bKeepSize;
+ bool m_bParentSizing;
+ bool m_bDragShowContent;
UINT m_nDockBarID;
int m_cxEdge;
* @param [out] diffs Pointer to list of change structs where diffdata is stored.
* @param [in] depth Depth in folder compare (we use 0).
* @param [out] bin_status used to return binary status from compare.
- * @param [in] bMovedBlocks If TRUE moved blocks are analyzed.
+ * @param [in] bMovedBlocks If `true` moved blocks are analyzed.
* @param [out] bin_file Returns which file was binary file as bitmap.
So if first file is binary, first bit is set etc. Can be NULL if binary file
info is not needed (faster compare since diffutils don't bother checking
second file if first is binary).
- * @return TRUE when compare succeeds, FALSE if error happened during compare.
+ * @return `true` when compare succeeds, `false` if error happened during compare.
*/
bool DiffUtils::Diff2Files(struct change ** diffs, int depth,
int * bin_status, bool bMovedBlocks, int * bin_file) const
WritePluginsInLogFile(L"BUFFER_PREDIFF");
FileWriteString(_T("\r\n Editor scripts: "));
WritePluginsInLogFile(L"EDITOR_SCRIPT");
- if (plugin::IsWindowsScriptThere() == FALSE)
+ if (!plugin::IsWindowsScriptThere())
FileWriteString(_T("\r\n .sct scripts disabled (Windows Script Host not found)\r\n"));
FileWriteString(_T("\r\n\r\n"));
const FileTextEncoding & encoding, CString &sError);
int SaveToFile (const String& pszFileName, bool bTempFile, String & sError,
PackingInfo * infoUnpacker = NULL, CRLFSTYLE nCrlfStyle = CRLF_STYLE_AUTOMATIC,
- bool bClearModifiedFlag = TRUE, int nStartLine = 0, int nLines = -1);
+ bool bClearModifiedFlag = true, int nStartLine = 0, int nLines = -1);
ucr::UNICODESET getUnicoding() const { return m_encoding.m_unicoding; }
void setUnicoding(ucr::UNICODESET value) { m_encoding.m_unicoding = value; }
int getCodepage() const { return m_encoding.m_codepage; }
// if line has any text (including eol), set strLine to text (including eol)
bool GetFullLine(int nLineIndex, CString &strLine) const;
- virtual void SetModified (bool bModified = TRUE) override;
+ virtual void SetModified (bool bModified = true) override;
void prepareForRescan();
virtual void OnNotifyLineHasBeenEdited(int nLine) override;
bool IsInitialized() const;
TViewBarBase::OnLButtonDown(nFlags, point);
if (m_pDockBar != NULL)
{
- if (IsHorzDocked() == FALSE)
+ if (!IsHorzDocked())
m_pDockContext->ToggleDocking();
}
}
/**
* @brief Generate report and save it to file.
* @param [out] errStr Empty if succeeded, otherwise contains error message.
- * @return TRUE if report was created, FALSE if user canceled report.
+ * @return `true` if report was created, `false` if user canceled report.
*/
bool DirCmpReport::GenerateReport(String &errStr)
{
if (dlg.m_bCopyToClipboard)
{
if (!CWnd::GetSafeOwner()->OpenClipboard())
- return FALSE;
+ return false;
if (!EmptyClipboard())
- return FALSE;
+ return false;
CSharedFile file(GMEM_DDESHARE|GMEM_MOVEABLE|GMEM_ZEROINIT);
m_pFile = &file;
GenerateReport(dlg.m_nReportType);
if (!paths::CreateIfNeeded(path))
{
errStr = _("Folder does not exist.");
- return FALSE;
+ return false;
}
CFile file(dlg.m_sReportFile.c_str(),
CFile::modeWrite|CFile::modeCreate|CFile::shareDenyWrite);
m_pFile = &file;
- m_bIncludeFileCmpReport = !!dlg.m_bIncludeFileCmpReport;
+ m_bIncludeFileCmpReport = dlg.m_bIncludeFileCmpReport;
GenerateReport(dlg.m_nReportType);
}
- bRet = TRUE;
+ bRet = true;
}
catch (CException *e)
{
String filter = tr(f_types[m_ctlStyle.GetCurSel()].browseFilter);
String chosenFilepath;
- if (SelectFile(GetSafeHwnd(), chosenFilepath, FALSE, folder.c_str(), _T(""), filter))
+ if (SelectFile(GetSafeHwnd(), chosenFilepath, false, folder.c_str(), _T(""), filter))
{
m_sReportFile = chosenFilepath;
m_ctlReportFile.SetWindowText(chosenFilepath.c_str());
{
// Get current column data
String text = m_listColumns.GetItemText(index, 0);
- BOOL checked = m_listColumns.GetCheck(index);
+ bool checked = m_listColumns.GetCheck(index);
UINT state = m_listColumns.GetItemState(index, LVIS_SELECTED);
DWORD_PTR data = m_listColumns.GetItemData(index);
for (int i = 0; i < m_listColumns.GetItemCount(); i++)
{
- BOOL checked = m_listColumns.GetCheck(i);
+ bool checked = m_listColumns.GetCheck(i);
DWORD_PTR data = m_listColumns.GetItemData(i);
column & col1 = m_cols[data];
if (checked)
* @param [in] pParent Parent window for progress dialog.
*/
DirCompProgressBar::DirCompProgressBar()
-: m_bCompareReady(FALSE)
+: m_bCompareReady(false)
, m_prevState(CompareStats::STATE_IDLE)
, m_pCompareStats(NULL)
#ifdef __ITaskbarList3_INTERFACE_DEFINED__
// Update total items too since we might get only this one state
// when compare is fast.
else if (state == CompareStats::STATE_IDLE &&
- m_bCompareReady == FALSE && m_pCompareStats->IsCompareDone() )
+ !m_bCompareReady && m_pCompareStats->IsCompareDone() )
{
SetProgressState(m_pCompareStats->GetComparedItems(), m_pCompareStats->GetTotalItems());
EndUpdating();
m_prevState = CompareStats::STATE_COMPARE;
- m_bCompareReady = TRUE;
+ m_bCompareReady = true;
}
}
else
private:
CompareStats *m_pCompareStats; /**< Pointer to comparestats */
CompareStats::CMP_STATE m_prevState; /**< Previous state for compare (to track changes) */
- BOOL m_bCompareReady; /**< Compare ready, waiting for closing? */
+ bool m_bCompareReady; /**< Compare ready, waiting for closing? */
#ifdef __ITaskbarList3_INTERFACE_DEFINED__
ITaskbarList3 *m_pTaskbarList;
#endif
: m_pCtxt(nullptr)
, m_pDirView(nullptr)
, m_pCompareStats(nullptr)
-, m_bMarkedRescan(FALSE)
+, m_bMarkedRescan(false)
, m_pTempPathContext(nullptr)
, m_bGeneratingReport(false)
{
{
ASSERT(m_pCtxt);
- BOOL bFilters = GetOptionsMgr()->GetBool(OPT_LINEFILTER_ENABLED);
+ bool bFilters = GetOptionsMgr()->GetBool(OPT_LINEFILTER_ENABLED);
String filters = theApp.m_pLineFilters->GetAsString();
if (!bFilters || filters.empty())
{
m_diffThread.SetContext(m_pCtxt.get());
m_diffThread.RemoveListener(this, &CDirDoc::DiffThreadCallback);
m_diffThread.AddListener(this, &CDirDoc::DiffThreadCallback);
- m_diffThread.SetCompareSelected(!!m_bMarkedRescan);
+ m_diffThread.SetCompareSelected(m_bMarkedRescan);
m_diffThread.CompareDirectories();
- m_bMarkedRescan = FALSE;
+ m_bMarkedRescan = false;
}
/**
*
* Asks confirmation for docs containing unsaved data and then
* closes MergeDocs.
- * @return TRUE if success, FALSE if user canceled or closing failed
+ * @return `true` if success, `false` if user canceled or closing failed
*/
-BOOL CDirDoc::CloseMergeDocs()
+bool CDirDoc::CloseMergeDocs()
{
while (!m_MergeDocs.IsEmpty())
if (!m_MergeDocs.GetTail()->CloseNow())
- return FALSE;
- return TRUE;
+ return false;
+ return true;
}
/**
* @param [in] bIdentical TRUE if files became identical, FALSE otherwise.
*/
void CDirDoc::UpdateChangedItem(PathContext &paths,
- UINT nDiffs, UINT nTrivialDiffs, BOOL bIdentical)
+ UINT nDiffs, UINT nTrivialDiffs, bool bIdentical)
{
uintptr_t pos = FindItemFromPaths(*m_pCtxt, paths);
// If we failed files could have been swapped so lets try again
// Operations
public:
- BOOL CloseMergeDocs();
+ bool CloseMergeDocs();
CDirView * GetMainView() const;
// Overrides
void RefreshOptions();
void CompareReady();
void UpdateChangedItem(PathContext & paths,
- UINT nDiffs, UINT nTrivialDiffs, BOOL bIdentical);
+ UINT nDiffs, UINT nTrivialDiffs, bool bIdentical);
void UpdateResources();
void InitStatusStrings();
void ReloadItemStatus(uintptr_t diffPos, int idx);
bool HasDiffs() const { return m_pCtxt != NULL; }
const CDiffContext & GetDiffContext() const { return *m_pCtxt; }
CDiffContext& GetDiffContext() { return *m_pCtxt.get(); }
- void SetMarkedRescan() {m_bMarkedRescan = TRUE; }
+ void SetMarkedRescan() {m_bMarkedRescan = true; }
const CompareStats * GetCompareStats() const { return m_pCompareStats.get(); };
bool IsArchiveFolders() const;
PluginManager& GetPluginManager() { return m_pluginman; };
String m_strDesc[3]; /**< Left/middle/right side desription text */
String m_sReportFile;
PluginManager m_pluginman;
- bool m_bMarkedRescan; /**< If TRUE next rescan scans only marked items */
+ bool m_bMarkedRescan; /**< If `true` next rescan scans only marked items */
bool m_bGeneratingReport;
};
const CDiffContext& ctxt = GetDiffContext();
// Get selected items from folder compare
- BOOL bValidFiles = TRUE;
+ bool bValidFiles = true;
for (DirItemIterator it = SelBegin(); bValidFiles && it != SelEnd(); ++it)
{
const DIFFITEM &item = *it;
{
LangMessageBox(IDS_CANNOT_CREATE_BINARYPATCH, MB_ICONWARNING |
MB_DONT_DISPLAY_AGAIN, IDS_CANNOT_CREATE_BINARYPATCH);
- bValidFiles = FALSE;
+ bValidFiles = false;
}
else if (item.diffcode.isDirectory())
{
LangMessageBox(IDS_CANNOT_CREATE_DIRPATCH, MB_ICONWARNING |
MB_DONT_DISPLAY_AGAIN, IDS_CANNOT_CREATE_DIRPATCH);
- bValidFiles = FALSE;
+ bValidFiles = false;
}
if (bValidFiles)
*/
void CDirView::OnUpdateItemRename(CCmdUI* pCmdUI)
{
- BOOL bEnabled = (1 == m_pList->GetSelectedCount());
+ bool bEnabled = (1 == m_pList->GetSelectedCount());
pCmdUI->Enable(bEnabled && SelBegin() != SelEnd());
}
bool m_bExpandSubdirs;
CFont m_font; /**< User-selected font */
UINT m_nHiddenItems; /**< Count of items we have hidden */
- bool m_bTreeMode; /**< TRUE if tree mode is on*/
+ bool m_bTreeMode; /**< `true` if tree mode is on*/
DirViewFilterSettings m_dirfilter;
std::unique_ptr<DirCompProgressBar> m_pCmpProgressBar;
clock_t m_compareStart; /**< Starting process time of the compare */
- bool m_bUserCancelEdit; /**< TRUE if the user cancels rename */
+ bool m_bUserCancelEdit; /**< `true` if the user cancels rename */
String m_lastCopyFolder; /**< Last Copy To -target folder. */
int m_firstDiffItem;
stInfo.dwFlags = STARTF_USESHOWWINDOW;
stInfo.wShowWindow = wShowWindow;
PROCESS_INFORMATION processInfo;
- BOOL retVal = CreateProcess(NULL, (LPTSTR)sCmd.c_str(),
+ bool retVal = !!CreateProcess(NULL, (LPTSTR)sCmd.c_str(),
NULL, NULL, FALSE, CREATE_DEFAULT_ERROR_MODE, NULL, NULL,
&stInfo, &processInfo);
if (!retVal)
* @brief Standard constructor.
*/
FileActionScript::FileActionScript()
-: m_bUseRecycleBin(TRUE)
-, m_bHasCopyOperations(FALSE)
-, m_bHasMoveOperations(FALSE)
-, m_bHasRenameOperations(FALSE)
-, m_bHasDelOperations(FALSE)
+: m_bUseRecycleBin(true)
+, m_bHasCopyOperations(false)
+, m_bHasMoveOperations(false)
+, m_bHasRenameOperations(false)
+, m_bHasDelOperations(false)
, m_hParentWindow(NULL)
, m_pCopyOperations(new ShellFileOperations())
, m_pMoveOperations(new ShellFileOperations())
/**
* @brief Does user want to move deleted files to Recycle Bin?
- * @param [in] bUseRecycleBin If TRUE deleted files are moved to Recycle Bin.
+ * @param [in] bUseRecycleBin If `true` deleted files are moved to Recycle Bin.
*/
-void FileActionScript::UseRecycleBin(BOOL bUseRecycleBin)
+void FileActionScript::UseRecycleBin(bool bUseRecycleBin)
{
m_bUseRecycleBin = bUseRecycleBin;
}
{
UINT operation = 0;
FILEOP_FLAGS operFlags = 0;
- BOOL bApplyToAll = FALSE;
- BOOL bContinue = TRUE;
+ bool bContinue = true;
// Copy operations first
operation = FO_COPY;
operFlags |= FOF_ALLOWUNDO;
vector<FileActionItem>::const_iterator iter = m_actions.begin();
- while (iter != m_actions.end() && bContinue == TRUE)
+ while (iter != m_actions.end() && bContinue)
{
- BOOL bSkip = FALSE;
+ bool bSkip = false;
if ((*iter).atype == FileAction::ACT_COPY && !(*iter).dirflag)
{
if (bContinue)
{
- if (!theApp.CreateBackup(TRUE, (*iter).dest))
+ if (!theApp.CreateBackup(true, (*iter).dest))
{
String strErr = _("Error backing up file");
AfxMessageBox(strErr.c_str(), MB_OK | MB_ICONERROR);
- bContinue = FALSE;
+ bContinue = false;
}
}
}
if ((*iter).atype == FileAction::ACT_COPY &&
- bSkip == FALSE && bContinue == TRUE)
+ !bSkip && bContinue)
{
m_pCopyOperations->AddSourceAndDestination((*iter).src, (*iter).dest);
- m_bHasCopyOperations = TRUE;
+ m_bHasCopyOperations = true;
}
++iter;
}
- if (bContinue == FALSE)
+ if (!bContinue)
{
- m_bHasCopyOperations = FALSE;
+ m_bHasCopyOperations = false;
m_pCopyOperations->Reset();
return SCRIPT_USERCANCEL;
}
if ((*iter).atype == FileAction::ACT_MOVE)
{
m_pMoveOperations->AddSourceAndDestination((*iter).src, (*iter).dest);
- m_bHasMoveOperations = TRUE;
+ m_bHasMoveOperations = true;
}
++iter;
}
if ((*iter).atype == FileAction::ACT_RENAME)
{
m_pRenameOperations->AddSourceAndDestination((*iter).src, (*iter).dest);
- m_bHasRenameOperations = TRUE;
+ m_bHasRenameOperations = true;
}
++iter;
}
m_pDelOperations->AddSource((*iter).src);
if (!(*iter).dest.empty())
m_pDelOperations->AddSource((*iter).dest);
- m_bHasDelOperations = TRUE;
+ m_bHasDelOperations = true;
}
++iter;
}
/**
* @brief Execute fileoperations.
- * @return TRUE if all actions were done successfully, FALSE otherwise.
+ * @return `true` if all actions were done successfully, `false` otherwise.
*/
-BOOL FileActionScript::Run()
+bool FileActionScript::Run()
{
// Now process files/directories that got added to list
bool bFileOpSucceed = true;
bool bUserCancelled = false;
- BOOL bRetVal = TRUE;
+ bool bRetVal = true;
CreateOperationsScripts();
bFileOpSucceed = RunOp(m_pMoveOperations.get(), bUserCancelled);
}
else
- bRetVal = FALSE;
+ bRetVal = false;
}
if (m_bHasRenameOperations)
bFileOpSucceed = RunOp(m_pRenameOperations.get(), bUserCancelled);
}
else
- bRetVal = FALSE;
+ bRetVal = false;
}
if (m_bHasDelOperations)
bFileOpSucceed = RunOp(m_pDelOperations.get(), bUserCancelled);
}
else
- bRetVal = FALSE;
+ bRetVal = false;
}
if (!bFileOpSucceed || bUserCancelled)
- bRetVal = FALSE;
+ bRetVal = false;
return bRetVal;
}
String src; /**< Source for action */
String dest; /**< Destination action */
- bool dirflag; /**< Is it directory? (TRUE means directory) */
+ bool dirflag; /**< Is it directory? (`true` means directory) */
ACT_TYPE atype; /**< Action's type */
};
~FileActionScript();
void SetParentWindow(HWND hWnd);
- void UseRecycleBin(BOOL bUseRecycleBin);
- BOOL Run();
+ void UseRecycleBin(bool bUseRecycleBin);
+ bool Run();
// Manipulate the FileActionList
size_t GetActionItemCount() const;
private:
std::vector<FileActionItem> m_actions; /**< List of all actions for this script. */
std::unique_ptr<ShellFileOperations> m_pCopyOperations; /**< Copy operations. */
- BOOL m_bHasCopyOperations; /**< flag if we've put anything into m_pCopyOperations */
+ bool m_bHasCopyOperations; /**< flag if we've put anything into m_pCopyOperations */
std::unique_ptr<ShellFileOperations> m_pMoveOperations; /**< Move operations. */
- BOOL m_bHasMoveOperations; /**< flag if we've put anything into m_pMoveOperations */
+ bool m_bHasMoveOperations; /**< flag if we've put anything into m_pMoveOperations */
std::unique_ptr<ShellFileOperations> m_pRenameOperations; /**< Rename operations. */
- BOOL m_bHasRenameOperations; /**< flag if we've put anything into m_pRenameOperations */
+ bool m_bHasRenameOperations; /**< flag if we've put anything into m_pRenameOperations */
std::unique_ptr<ShellFileOperations> m_pDelOperations; /**< Delete operations. */
- BOOL m_bHasDelOperations; /**< flag if we've put anything into m_pDelOperations */
- BOOL m_bUseRecycleBin; /**< Use recycle bin for script actions? */
+ bool m_bHasDelOperations; /**< flag if we've put anything into m_pDelOperations */
+ bool m_bUseRecycleBin; /**< Use recycle bin for script actions? */
HWND m_hParentWindow; /**< Parent window for showing messages */
};
std::unique_ptr<FileFilterMgr> m_fileFilterMgr; /*< Associated FileFilterMgr */
String m_sFileFilterPath; /*< Path to current filter */
String m_sMask; /*< File mask (if defined) "*.cpp *.h" etc */
- bool m_bUseMask; /*< If TRUE file mask is used, filter otherwise */
+ bool m_bUseMask; /*< If `true` file mask is used, filter otherwise */
String m_sGlobalFilterPath; /*< Path for shared filters */
String m_sUserSelFilterPath; /*< Path for user's private filters */
};
path = paths::AddTrailingSlash(path);
String s;
- if (SelectFile(GetSafeHwnd(), s, FALSE, path.c_str(), _("Select filename for new filter"),
+ if (SelectFile(GetSafeHwnd(), s, false, path.c_str(), _("Select filename for new filter"),
_("File Filters (*.flt)|*.flt|All Files (*.*)|*.*||")))
{
// Fix file extension
String path;
String userPath = theApp.m_pGlobalFileFilter->GetUserFilterPathWithCreate();
- if (SelectFile(GetSafeHwnd(), s, TRUE, path.c_str(),_("Locate filter file to install"),
+ if (SelectFile(GetSafeHwnd(), s, true, path.c_str(),_("Locate filter file to install"),
_("File Filters (*.flt)|*.flt|All Files (*.*)|*.*||")))
{
userPath = paths::ConcatPath(userPath, paths::FindFileName(s));
* modality problems with this. Dialog can be lost behind other windows!
* @param [in] defaultExtension Extension to append if user doesn't provide one
*/
-BOOL SelectFile(HWND parent, String& path,BOOL is_open /*=TRUE*/,
+bool SelectFile(HWND parent, String& path, bool is_open /*= true*/,
LPCTSTR initialPath /*=NULL*/, const String& stitle /*=_T("")*/,
const String& sfilter /*=_T("")*/, LPCTSTR defaultExtension /*=NULL*/)
{
ofn.lpstrDefExt = defaultExtension;
ofn.Flags = OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST | OFN_NOCHANGEDIR;
- BOOL bRetVal = FALSE;
+ bool bRetVal = false;
if (is_open)
- bRetVal = GetOpenFileName((OPENFILENAME *)&ofn);
+ bRetVal = !!GetOpenFileName((OPENFILENAME *)&ofn);
else
- bRetVal = GetSaveFileName((OPENFILENAME *)&ofn);
+ bRetVal = !!GetSaveFileName((OPENFILENAME *)&ofn);
// common file dialog populated sSelectedFile variable's buffer
if (bRetVal)
* @param [in] root_path Initial path shown when dialog is opened
* @param [in] titleid Resource string ID for dialog title.
* @param [in] hwndOwner Handle to owner window or NULL
- * @return TRUE if valid folder selected (not cancelled)
+ * @return `true` if valid folder selected (not cancelled)
*/
-BOOL SelectFolder(String& path, LPCTSTR root_path /*=NULL*/,
+bool SelectFolder(String& path, LPCTSTR root_path /*=NULL*/,
const String& stitle /*=_T("")*/,
HWND hwndOwner /*=NULL*/)
{
BROWSEINFO bi;
LPITEMIDLIST pidl;
TCHAR szPath[MAX_PATH_FULL] = {0};
- BOOL bRet = FALSE;
+ bool bRet = false;
String title = stitle;
if (root_path == NULL)
LastSelectedFolder.clear();
if (SHGetPathFromIDList(pidl, szPath))
{
path = szPath;
- bRet = TRUE;
+ bRet = true;
}
CoTaskMemFree(pidl);
}
* CMainFrame is used which can cause modality problems.
* @param [out] path Selected folder/filename
* @param [in] initialPath Initial file or folder shown/selected.
- * @return TRUE if user choosed a file/folder, FALSE if user canceled dialog.
+ * @return `true` if user choosed a file/folder, `false` if user canceled dialog.
*/
-BOOL SelectFileOrFolder(HWND parent, String& path, LPCTSTR initialPath /*=NULL*/)
+bool SelectFileOrFolder(HWND parent, String& path, LPCTSTR initialPath /*=NULL*/)
{
String title = _("Open");
ofn.lpstrFileTitle = NULL;
ofn.Flags = OFN_HIDEREADONLY | OFN_PATHMUSTEXIST | OFN_NOTESTFILECREATE | OFN_NOCHANGEDIR;
- BOOL bRetVal = GetOpenFileName((OPENFILENAME *)&ofn);
+ bool bRetVal = !!GetOpenFileName((OPENFILENAME *)&ofn);
if (bRetVal)
{
#include "UnicodeString.h"
-BOOL SelectFile(HWND parent, String& path, BOOL is_open =TRUE,
+bool SelectFile(HWND parent, String& path, bool is_open = true,
LPCTSTR initialPath = NULL, const String& stitle = _T(""),
const String& sfilter = _T(""), LPCTSTR defaultExtension = NULL);
-BOOL SelectFolder(String& path, LPCTSTR root_path = NULL,
+bool SelectFolder(String& path, LPCTSTR root_path = NULL,
const String& title = _T(""),
HWND hwndOwner = NULL);
-BOOL SelectFileOrFolder(HWND parent, String& path, LPCTSTR root_path = NULL);
+bool SelectFileOrFolder(HWND parent, String& path, LPCTSTR root_path = NULL);
int bToBeScanned; // TODO: Convert to PLUGIN_MODE and fix compile errors
/// plugin name when it is defined
String pluginName;
- /// TRUE is the plugins exchange data through a file, false is the data is passed as parameter (BSTR/ARRAY)
+ /// `true` is the plugins exchange data through a file, false is the data is passed as parameter (BSTR/ARRAY)
bool bWithFile;
};
CFilepathEdit::CFilepathEdit()
: m_crBackGnd(RGB(255, 255, 255))
, m_crText(RGB(0,0,0))
- , m_bActive(FALSE)
+ , m_bActive(false)
{
}
*/
BOOL CFilepathEdit::SubClassEdit(UINT nID, CWnd* pParent)
{
- m_bActive = FALSE;
+ m_bActive = false;
return SubclassDlgItem(nID, pParent);
};
String m_sToolTipString; /**< buffer for return data from GetUpdatedTipText */
String m_sOriginalText; /**< Full path that was given to control */
- BOOL m_bActive; /**< Is the control active-looking? */
+ bool m_bActive; /**< Is the control active-looking? */
COLORREF m_crText; /**< Control's text color. */
COLORREF m_crBackGnd; /**< Control's background color. */
CBrush m_brBackGnd; /**< Background brush for the control. */
if (m_pTimeSizeCompare == NULL)
m_pTimeSizeCompare.reset(new TimeSizeCompare());
- m_pTimeSizeCompare->SetAdditionalOptions(!!pCtxt->m_bIgnoreSmallTimeDiff);
+ m_pTimeSizeCompare->SetAdditionalOptions(pCtxt->m_bIgnoreSmallTimeDiff);
code = m_pTimeSizeCompare->CompareFiles(nCompMethod, pCtxt->GetCompareDirs(), di);
}
else
::UpdateDiffItem(m_nBuffers, di, &ctxt);
}
}
- BOOL bDiff = FALSE;
+ bool bDiff = false;
int lengthFirst = m_pView[0]->GetLength();
void *bufferFirst = m_pView[0]->GetBuffer(lengthFirst);
for (int nBuffer = 1; nBuffer < m_nBuffers; nBuffer++)
{
int length = m_pView[nBuffer]->GetLength();
if (lengthFirst != length)
- bDiff = TRUE;
+ bDiff = true;
else
{
void *buffer = m_pView[nBuffer]->GetBuffer(length);
/**
* @brief Asks and then saves modified files
*/
-BOOL CHexMergeDoc::PromptAndSaveIfNeeded(BOOL bAllowCancel)
+bool CHexMergeDoc::PromptAndSaveIfNeeded(bool bAllowCancel)
{
bool bLModified = false, bMModified = false, bRModified = false;
if (m_nBuffers == 3)
{
- bLModified = !!m_pView[0]->GetModified();
- bMModified = !!m_pView[1]->GetModified();
- bRModified = !!m_pView[2]->GetModified();
+ bLModified = m_pView[0]->GetModified();
+ bMModified = m_pView[1]->GetModified();
+ bRModified = m_pView[2]->GetModified();
}
else
{
- bLModified = !!m_pView[0]->GetModified();
- bRModified = !!m_pView[1]->GetModified();
+ bLModified = m_pView[0]->GetModified();
+ bRModified = m_pView[1]->GetModified();
}
if (!bLModified && !bMModified && !bRModified)
- return TRUE;
+ return true;
const String &pathLeft = m_filePaths.GetLeft();
const String &pathMiddle = m_filePaths.GetMiddle();
const String &pathRight = m_filePaths.GetRight();
- BOOL result = TRUE;
+ bool result = true;
bool bLSaveSuccess = false, bMSaveSuccess = false, bRSaveSuccess = false;
SaveClosingDlg dlg;
switch (Try(m_pView[0]->SaveFile(pathLeft.c_str())))
{
case 0:
- bLSaveSuccess = TRUE;
+ bLSaveSuccess = true;
break;
case IDCANCEL:
- result = FALSE;
+ result = false;
break;
}
}
switch (Try(m_pView[1]->SaveFile(pathMiddle.c_str())))
{
case 0:
- bMSaveSuccess = TRUE;
+ bMSaveSuccess = true;
break;
case IDCANCEL:
- result = FALSE;
+ result = false;
break;
}
}
switch (Try(m_pView[m_nBuffers - 1]->SaveFile(pathRight.c_str())))
{
case 0:
- bRSaveSuccess = TRUE;
+ bRSaveSuccess = true;
break;
case IDCANCEL:
- result = FALSE;
+ result = false;
break;
}
}
*/
BOOL CHexMergeDoc::SaveModified()
{
- return PromptAndSaveIfNeeded(TRUE);
+ return PromptAndSaveIfNeeded(true);
}
/**
title = _("Save Right File As");
else
title = _("Save Middle File As");
- if (SelectFile(AfxGetMainWnd()->GetSafeHwnd(), strPath, FALSE, path.c_str(), title))
+ if (SelectFile(AfxGetMainWnd()->GetSafeHwnd(), strPath, false, path.c_str(), title))
{
if (Try(m_pView[nBuffer]->SaveFile(strPath.c_str())) == IDCANCEL)
return;
bool CHexMergeDoc::CloseNow()
{
// Allow user to cancel closing
- if (!PromptAndSaveIfNeeded(TRUE))
+ if (!PromptAndSaveIfNeeded(true))
return false;
GetParentFrame()->CloseNow();
/**
* @brief Load one file
*/
-HRESULT CHexMergeDoc::LoadOneFile(int index, LPCTSTR filename, BOOL readOnly, const String& strDesc)
+HRESULT CHexMergeDoc::LoadOneFile(int index, LPCTSTR filename, bool readOnly, const String& strDesc)
{
if (filename[0])
{
*/
static void Customize(IHexEditorWindow::Settings *settings)
{
- settings->bSaveIni = FALSE;
+ settings->bSaveIni = false;
//settings->iAutomaticBPL = FALSE;
//settings->iBytesPerLine = 16;
//settings->iFontSize = 8;
*/
void CHexMergeDoc::OnUpdateFileSave(CCmdUI* pCmdUI)
{
- BOOL bModified = FALSE;
+ bool bModified = false;
for (int nBuffer = 0; nBuffer < m_nBuffers; nBuffer++)
bModified |= m_pView[nBuffer]->GetModified();
pCmdUI->Enable(bModified);
for (int pane = 0; pane < m_nBuffers; pane++)
{
fileloc[pane].setPath(m_filePaths[pane]);
- bRO[pane] = !!m_pView[pane]->GetReadOnly();
+ bRO[pane] = m_pView[pane]->GetReadOnly();
}
int nActivePane = GetActiveMergeView()->m_nThisPane;
OpenDocs(m_nBuffers, fileloc, bRO, m_strDesc, nActivePane);
public:
~CHexMergeDoc();
int UpdateDiffItem(CDirDoc * pDirDoc);
- BOOL PromptAndSaveIfNeeded(BOOL bAllowCancel);
+ bool PromptAndSaveIfNeeded(bool bAllowCancel);
void SetDirDoc(CDirDoc * pDirDoc);
void DirDocClosing(CDirDoc * pDirDoc);
bool CloseNow();
private:
void DoFileSave(int nBuffer);
void DoFileSaveAs(int nBuffer);
- HRESULT LoadOneFile(int index, LPCTSTR filename, BOOL readOnly, const String& strDesc);
+ HRESULT LoadOneFile(int index, LPCTSTR filename, bool readOnly, const String& strDesc);
// Implementation data
protected:
CHexMergeView * m_pView[3]; /**< Pointer to left/right view */
}
}
- m_wndSplitter.ResizablePanes(TRUE);
+ m_wndSplitter.ResizablePanes(true);
m_wndSplitter.AutoResizePanes(GetOptionsMgr()->GetBool(OPT_RESIZE_PANES));
// Merge frame has a header bar at top
/**
* @brief Checks if file has changed since last update
* @param [in] path File to check
- * @return TRUE if file is changed.
+ * @return `true` if file is changed.
*/
-BOOL CHexMergeView::IsFileChangedOnDisk(LPCTSTR path)
+bool CHexMergeView::IsFileChangedOnDisk(LPCTSTR path)
{
DiffFileInfo dfi;
dfi.Update(path);
}
// Ask user what to do about FILE_ATTRIBUTE_READONLY
String strPath = path;
- BOOL bApplyToAll = FALSE;
- if (theApp.HandleReadonlySave(strPath, FALSE, bApplyToAll) == IDCANCEL)
+ bool bApplyToAll = false;
+ if (theApp.HandleReadonlySave(strPath, false, bApplyToAll) == IDCANCEL)
return S_OK;
path = strPath.c_str();
// Take a chance to create a backup
- if (!theApp.CreateBackup(FALSE, path))
+ if (!theApp.CreateBackup(false, path))
return S_OK;
// Write data to an intermediate file
String tempPath = env::GetTemporaryPath();
/**
* @brief Get modified flag
*/
-BOOL CHexMergeView::GetModified()
+bool CHexMergeView::GetModified()
{
- return m_pif->get_status()->iFileChanged;
+ return m_pif->get_status()->bFileChanged;
}
/**
/**
* @brief Get readonly flag
*/
-BOOL CHexMergeView::GetReadOnly()
+bool CHexMergeView::GetReadOnly()
{
return m_pif->get_settings()->bReadOnly;
}
/**
* @brief Set readonly flag
*/
-void CHexMergeView::SetReadOnly(BOOL bReadOnly)
+void CHexMergeView::SetReadOnly(bool bReadOnly)
{
m_pif->get_settings()->bReadOnly = bReadOnly;
}
IHexEditorWindow *GetInterface() const { return m_pif; }
BYTE *GetBuffer(int);
int GetLength();
- BOOL GetModified();
+ bool GetModified();
void SetSavePoint();
void ClearUndoRecords();
- BOOL GetReadOnly();
- void SetReadOnly(BOOL);
+ bool GetReadOnly();
+ void SetReadOnly(bool);
void ResizeWindow();
- BOOL IsFileChangedOnDisk(LPCTSTR);
+ bool IsFileChangedOnDisk(LPCTSTR);
void ZoomText(int amount);
static void CopySel(const CHexMergeView *src, CHexMergeView *dst);
static void CopyAll(const CHexMergeView *src, CHexMergeView *dst);
* The bars are identified with their ID. This means the missing bar bug is triggered
* when we run WinMerge after changing the ID of a bar.
*/
-BOOL CImgMergeFrame::EnsureValidDockState(CDockState& state)
+bool CImgMergeFrame::EnsureValidDockState(CDockState& state)
{
for (int i = (int)state.m_arrBarInfo.GetSize() - 1; i >= 0; i--)
{
- BOOL barIsCorrect = TRUE;
+ bool barIsCorrect = true;
CControlBarInfo* pInfo = (CControlBarInfo*)state.m_arrBarInfo[i];
if (!pInfo)
- barIsCorrect = FALSE;
+ barIsCorrect = false;
else
{
if (!pInfo->m_bFloating)
{
pInfo->m_pBar = GetControlBar(pInfo->m_nBarID);
if (!pInfo->m_pBar)
- barIsCorrect = FALSE; //toolbar id's probably changed
+ barIsCorrect = false; //toolbar id's probably changed
}
}
else
{
String filename = ucr::toTString(m_pImgMergeWindow->GetFileName(pane));
- BOOL bApplyToAll = FALSE;
- if (theApp.HandleReadonlySave(filename, FALSE, bApplyToAll) == IDCANCEL)
+ bool bApplyToAll = false;
+ if (theApp.HandleReadonlySave(filename, false, bApplyToAll) == IDCANCEL)
return false;
theApp.CreateBackup(false, filename);
if (!m_pImgMergeWindow->SaveImage(pane))
title = _("Save Right File As");
else
title = _("Save Middle File As");
- if (SelectFile(AfxGetMainWnd()->GetSafeHwnd(), strPath, FALSE, path.c_str(), title))
+ if (SelectFile(AfxGetMainWnd()->GetSafeHwnd(), strPath, false, path.c_str(), title))
{
std::wstring filename = ucr::toUTF16(strPath).c_str();
- BOOL bApplyToAll = FALSE;
if (m_pImgMergeWindow->SaveImageAs(pane, filename.c_str()))
return false;
if (path.empty())
// Implementation
private:
- BOOL EnsureValidDockState(CDockState& state);
+ bool EnsureValidDockState(CDockState& state);
void LoadOptions();
void SaveOptions();
void SavePosition();
TViewBarBase::OnLButtonDown(nFlags, point);
if (m_pDockBar != NULL)
{
- if (IsVertDocked() == FALSE)
+ if (!IsVertDocked())
m_pDockContext->ToggleDocking();
}
}
, m_hwndFrame(nullptr)
, m_pSavedBackgroundBitmap(nullptr)
, m_bDrawn(false)
- , m_bRecalculateBlocks(TRUE) // calculate for the first time
+ , m_bRecalculateBlocks(true) // calculate for the first time
{
// NB: set m_bIgnoreTrivials to false to see trivial diffs in the LocationView
// There is no GUI to do this
*/
void CLocationView::ForceRecalculate()
{
- m_bRecalculateBlocks = TRUE;
+ m_bRecalculateBlocks = true;
Invalidate();
}
UNREFERENCED_PARAMETER(pSender);
UNREFERENCED_PARAMETER(lHint);
- m_bRecalculateBlocks = TRUE;
+ m_bRecalculateBlocks = true;
Invalidate();
}
nDiff = pDoc->m_diffList.NextSignificantDiff(nDiff);
}
- m_bRecalculateBlocks = FALSE;
+ m_bRecalculateBlocks = false;
}
/**
if (!pDoc->GetView(nGroup, 0)->IsInitialized()) return;
- BOOL bEditedAfterRescan = FALSE;
+ bool bEditedAfterRescan = false;
int nPaneNotModified = -1;
for (int pane = 0; pane < pDoc->m_nBuffers; pane++)
{
if (!pDoc->IsEditedAfterRescan(pane))
nPaneNotModified = pane;
else
- bEditedAfterRescan = TRUE;
+ bEditedAfterRescan = true;
}
CRect rc;
if (nPaneNotModified == -1)
continue;
CMergeEditView *pView = pDoc->GetView(nGroup, nPaneNotModified);
- const BOOL bInsideDiff = (nCurDiff == (*iter).diff_index);
+ const bool bInsideDiff = (nCurDiff == (*iter).diff_index);
if ((nPrevEndY != (*iter).bottom_coord) || bInsideDiff)
{
nPrevEndY = (*iter).bottom_coord;
// Test if we draw a connector
- BOOL bDisplayConnectorFromLeft = FALSE;
- BOOL bDisplayConnectorFromRight = FALSE;
+ bool bDisplayConnectorFromLeft = false;
+ bool bDisplayConnectorFromRight = false;
switch (m_displayMovedBlocks)
{
if (!bInsideDiff)
break;
// two sides may be linked to a block somewhere else
- bDisplayConnectorFromLeft = TRUE;
- bDisplayConnectorFromRight = TRUE;
+ bDisplayConnectorFromLeft = true;
+ bDisplayConnectorFromRight = true;
break;
case DISPLAY_MOVED_ALL:
// we display all moved blocks, so once direction is enough
- bDisplayConnectorFromLeft = TRUE;
+ bDisplayConnectorFromLeft = true;
break;
default:
break;
* @param [in] cr Color for rectangle.
* @param [in] bSelected Is rectangle for selected difference?
*/
-void CLocationView::DrawRect(CDC* pDC, const CRect& r, COLORREF cr, BOOL bSelected)
+void CLocationView::DrawRect(CDC* pDC, const CRect& r, COLORREF cr, bool bSelected /*= false*/)
{
// Draw only colored blocks
if (cr != CLR_NONE && cr != GetSysColor(COLOR_WINDOW))
* cannot be used to scroll to ghost lines.
*
* @param [in] point Point to move to
- * @param [in] bRealLine TRUE if we want to scroll using real line num,
+ * @param [in] bRealLine `true` if we want to scroll using real line num,
* FALSE if view linenumbers are OK.
- * @return TRUE if succeeds, FALSE if point not inside bars.
+ * @return `true` if succeeds, `false` if point not inside bars.
*/
-bool CLocationView::GotoLocation(const CPoint& point, bool bRealLine)
+bool CLocationView::GotoLocation(const CPoint& point, bool bRealLine /*= true*/)
{
CRect rc;
GetClientRect(rc);
{
// Outside bars, use left bar
bar = BAR_0;
- line = GetLineFromYPos(point.y, bar, FALSE);
+ line = GetLineFromYPos(point.y, bar, false);
}
else
return false;
* @param [in] bRealLine TRUE if real line is returned, FALSE for view line
* @return 0-based index of view/real line in file [0...lines-1]
*/
-int CLocationView::GetLineFromYPos(int nYCoord, int bar, BOOL bRealLine)
+int CLocationView::GetLineFromYPos(int nYCoord, int bar, bool bRealLine /*= true*/)
{
CMergeEditView *pView = GetDocument()->GetActiveMergeGroupView(bar);
}
// We've got a view line now
- if (bRealLine == FALSE)
+ if (!bRealLine)
return nLine;
// Get real line (exclude ghost lines)
// TODO: Perhaps this should be determined from need to change bar size?
// And we could change bar sizes more lazily, not from every one pixel change in size?
if (cy != m_currentSize.cy)
- m_bRecalculateBlocks = TRUE;
+ m_bRecalculateBlocks = true;
if (cx != m_currentSize.cx)
{
protected:
CMergeDoc* GetDocument();
- void DrawRect(CDC* pDC, const CRect& r, COLORREF cr, BOOL bSelected = FALSE);
+ void DrawRect(CDC* pDC, const CRect& r, COLORREF cr, bool bSelected = false);
bool GotoLocation(const CPoint& point, bool bRealLine = true);
- int GetLineFromYPos(int nYCoord, int bar, BOOL bRealLine = TRUE);
+ int GetLineFromYPos(int nYCoord, int bar, bool bRealLine = true);
int IsInsideBar(const CRect& rc, const POINT& pt);
void DrawVisibleAreaRect(CDC* pDC, int nTopLine = -1, int nBottomLine = -1);
void DrawConnectLines(CDC* pDC);
std::unique_ptr<CBitmap> m_pSavedBackgroundBitmap; //*< Saved background */
bool m_bDrawn; //*< Is already drawn in location pane? */
std::vector<DiffBlock> m_diffBlocks; //*< List of pre-calculated diff blocks.
- BOOL m_bRecalculateBlocks; //*< Recalculate diff blocks in next repaint.
+ bool m_bRecalculateBlocks; //*< Recalculate diff blocks in next repaint.
CSize m_currentSize; //*< Current size of the panel.
// Generated message map functions
* @todo Preference for logging?
*/
CMainFrame::CMainFrame()
-: m_bFirstTime(TRUE)
+: m_bFirstTime(true)
, m_pDropHandler(NULL)
, m_bShowErrors(false)
{
}
m_wndTabBar.SetAutoMaxWidth(GetOptionsMgr()->GetBool(OPT_TABBAR_AUTO_MAXWIDTH));
- if (GetOptionsMgr()->GetBool(OPT_SHOW_TABBAR) == false)
+ if (!GetOptionsMgr()->GetBool(OPT_SHOW_TABBAR))
CMDIFrameWnd::ShowControlBar(&m_wndTabBar, false, 0);
if (!m_wndStatusBar.Create(this))
m_wndStatusBar.SetPaneInfo(2, ID_STATUS_MERGINGMODE, 0, pointToPixel(75));
m_wndStatusBar.SetPaneInfo(3, ID_STATUS_DIFFNUM, 0, pointToPixel(112));
- if (GetOptionsMgr()->GetBool(OPT_SHOW_STATUSBAR) == false)
+ if (!GetOptionsMgr()->GetBool(OPT_SHOW_STATUSBAR))
CMDIFrameWnd::ShowControlBar(&m_wndStatusBar, false, 0);
m_pDropHandler = new DropHandler(std::bind(&CMainFrame::OnDropFiles, this, std::placeholders::_1));
void CMainFrame::OnMeasureItem(int nIDCtl,
LPMEASUREITEMSTRUCT lpMeasureItemStruct)
{
- BOOL setflag = FALSE;
+ bool setflag = false;
if (lpMeasureItemStruct->CtlType == ODT_MENU)
{
if (IsMenu(reinterpret_cast<HMENU>(static_cast<uintptr_t>(lpMeasureItemStruct->itemID))))
if (m_pMenus[MENU_DEFAULT]->IsMenu(cmenu))
{
m_pMenus[MENU_DEFAULT]->MeasureItem(lpMeasureItemStruct);
- setflag = TRUE;
+ setflag = true;
}
}
}
{
if (dwFlags)
{
- BOOL bModified = (dwFlags[pane] & FFILEOPEN_MODIFIED) > 0;
+ bool bModified = (dwFlags[pane] & FFILEOPEN_MODIFIED) > 0;
if (bModified)
{
pMergeDoc->m_ptBuf[pane]->SetModified(TRUE);
* @param [in] bRecurse Do we run recursive (folder) compare?
* @param [in] pDirDoc Dir compare document to use.
* @param [in] prediffer Prediffer plugin name.
- * @return TRUE if opening files and compare succeeded, FALSE otherwise.
+ * @return `true` if opening files and compare succeeded, `false` otherwise.
*/
-BOOL CMainFrame::DoFileOpen(const PathContext * pFiles /*=NULL*/,
- const DWORD dwFlags[] /*=NULL*/, const String strDesc[] /*=NULL*/, const String& sReportFile /*=T("")*/, bool bRecurse /*=FALSE*/, CDirDoc *pDirDoc/*=NULL*/,
+bool CMainFrame::DoFileOpen(const PathContext * pFiles /*=NULL*/,
+ const DWORD dwFlags[] /*=NULL*/, const String strDesc[] /*=NULL*/, const String& sReportFile /*=T("")*/, bool bRecurse /*= false*/, CDirDoc *pDirDoc/*=NULL*/,
String prediffer /*=_T("")*/, const PackingInfo *infoUnpacker/*=NULL*/)
{
if (pDirDoc && !pDirDoc->CloseMergeDocs())
return;
}
- m_bFirstTime = FALSE;
+ m_bFirstTime = false;
WINDOWPLACEMENT wp;
wp.length = sizeof(WINDOWPLACEMENT);
return;
// Check if there are multiple windows open and ask for closing them
- BOOL bAskClosing = GetOptionsMgr()->GetBool(OPT_ASK_MULTIWINDOW_CLOSE);
+ bool bAskClosing = GetOptionsMgr()->GetBool(OPT_ASK_MULTIWINDOW_CLOSE);
if (bAskClosing)
{
bool quit = AskCloseConfirmation();
GetOptionsMgr()->SaveOption(OPT_LINEFILTER_ENABLED, linefiltersEnabled);
// Check if compare documents need rescanning
- BOOL bFileCompareRescan = FALSE;
- BOOL bFolderCompareRescan = FALSE;
+ bool bFileCompareRescan = false;
+ bool bFolderCompareRescan = false;
CFrameWnd * pFrame = GetActiveFrame();
FRAMETYPE frame = GetFrameType(pFrame);
if (frame == FRAME_FILE)
if (lineFiltersEnabledOrig != linefiltersEnabled ||
!theApp.m_pLineFilters->Compare(lineFilters.get()))
{
- bFileCompareRescan = TRUE;
+ bFileCompareRescan = true;
}
}
else if (frame == FRAME_FOLDER)
{
int res = LangMessageBox(IDS_FILTERCHANGED, MB_ICONWARNING | MB_YESNO);
if (res == IDYES)
- bFolderCompareRescan = TRUE;
+ bFolderCompareRescan = true;
}
}
// get the default projects path
String strProjectPath = GetOptionsMgr()->GetString(OPT_PROJECTS_PATH);
- if (!SelectFile(GetSafeHwnd(), sFilepath, TRUE, strProjectPath.c_str(), _T(""),
+ if (!SelectFile(GetSafeHwnd(), sFilepath, true, strProjectPath.c_str(), _T(""),
_("WinMerge Project Files (*.WinMerge)|*.WinMerge||")))
return;
nStyle |= TBSTYLE_DROPDOWN;
m_wndToolBar.SetButtonInfo(index, nID, nStyle, iImage);
- if (GetOptionsMgr()->GetBool(OPT_SHOW_TOOLBAR) == false)
+ if (!GetOptionsMgr()->GetBool(OPT_SHOW_TOOLBAR))
{
CMDIFrameWnd::ShowControlBar(&m_wndToolBar, false, 0);
}
* file as resolved file.
* @param [in] conflictFile Full path to conflict file to open.
* @param [in] checked If true, do not check if it really is project file.
- * @return TRUE if conflict file was opened for resolving.
+ * @return `true` if conflict file was opened for resolving.
*/
-BOOL CMainFrame::DoOpenConflict(const String& conflictFile, const String strDesc[], bool checked)
+bool CMainFrame::DoOpenConflict(const String& conflictFile, const String strDesc[] /*= nullptr*/, bool checked /*= false*/)
{
- BOOL conflictCompared = FALSE;
+ bool conflictCompared = false;
if (!checked)
{
{
String message = strutils::format_string1(_("The file\n%1\nis not a conflict file."), conflictFile);
AfxMessageBox(message.c_str(), MB_ICONSTOP);
- return FALSE;
+ return false;
}
}
*/
CMainFrame::FRAMETYPE CMainFrame::GetFrameType(const CFrameWnd * pFrame) const
{
- BOOL bMergeFrame = pFrame->IsKindOf(RUNTIME_CLASS(CChildFrame));
- BOOL bHexMergeFrame = pFrame->IsKindOf(RUNTIME_CLASS(CHexMergeFrame));
- BOOL bImgMergeFrame = pFrame->IsKindOf(RUNTIME_CLASS(CImgMergeFrame));
- BOOL bDirFrame = pFrame->IsKindOf(RUNTIME_CLASS(CDirFrame));
+ bool bMergeFrame = pFrame->IsKindOf(RUNTIME_CLASS(CChildFrame));
+ bool bHexMergeFrame = pFrame->IsKindOf(RUNTIME_CLASS(CHexMergeFrame));
+ bool bImgMergeFrame = pFrame->IsKindOf(RUNTIME_CLASS(CImgMergeFrame));
+ bool bDirFrame = pFrame->IsKindOf(RUNTIME_CLASS(CDirFrame));
if (bMergeFrame)
return FRAME_FILE;
// Attributes
public:
- BOOL m_bShowErrors; /**< Show folder compare error items? */
+ bool m_bShowErrors; /**< Show folder compare error items? */
LOGFONT m_lfDiff; /**< MergeView user-selected font */
LOGFONT m_lfDir; /**< DirView user-selected font */
static const TCHAR szClassName[];
void UpdatePrediffersMenu();
void FileNew(int nPanes);
- BOOL DoFileOpen(const PathContext *pFiles = NULL,
+ bool DoFileOpen(const PathContext *pFiles = NULL,
const DWORD dwFlags[] = NULL, const String strDesc[] = NULL, const String& sReportFile = _T(""), bool bRecurse = false, CDirDoc *pDirDoc = NULL, String prediffer = _T(""), const PackingInfo * infoUnpacker = NULL);
bool ShowAutoMergeDoc(CDirDoc * pDirDoc, int nFiles, const FileLocation fileloc[],
const DWORD dwFlags[], const String strDesc[], const String& sReportFile = _T(""), const PackingInfo * infoUnpacker = NULL);
void SelectFilter();
void StartFlashing();
bool AskCloseConfirmation();
- BOOL DoOpenConflict(const String& conflictFile, const String strDesc[] = nullptr, bool checked = false);
+ bool DoOpenConflict(const String& conflictFile, const String strDesc[] = nullptr, bool checked = false);
FRAMETYPE GetFrameType(const CFrameWnd * pFrame) const;
void UpdateDocTitle();
void ReloadMenu();
// Public implementation data
public:
- BOOL m_bFirstTime; /**< If first time frame activated, get pos from reg */
+ bool m_bFirstTime; /**< If first time frame activated, get pos from reg */
// Implementation data
protected:
// CMergeApp construction
CMergeApp::CMergeApp() :
- m_bNeedIdleTimer(FALSE)
+ m_bNeedIdleTimer(false)
, m_pOpenTemplate(0)
, m_pDiffTemplate(0)
, m_pHexMergeTemplate(0)
, m_pGlobalFileFilter(new FileFilterHelper())
, m_nActiveOperations(0)
, m_pLangDlg(new CLanguageSelect())
-, m_bEscShutdown(FALSE)
+, m_bEscShutdown(false)
, m_bExitIfNoDiff(MergeCmdLineInfo::Disabled)
, m_pLineFilters(new LineFiltersList())
, m_pFilterCommentsManager(new FilterCommentsManager())
, m_pSyntaxColors(new SyntaxColors())
, m_pMarkers(new CCrystalTextMarkers())
-, m_bMergingMode(FALSE)
+, m_bMergingMode(false)
{
// add construction code here,
// Place all significant initialization in InitInstance
// If paths were given to commandline we consider this being an invoke from
// commandline (from other application, shellextension etc).
- BOOL bCommandLineInvoke = cmdInfo.m_Files.GetSize() > 0;
+ bool bCommandLineInvoke = cmdInfo.m_Files.GetSize() > 0;
// WinMerge registry settings are stored under HKEY_CURRENT_USER/Software/Thingamahoochie
// This is the name of the company of the original author (Dean Grimm)
SetRegistryKey(_T("Thingamahoochie"));
- BOOL bSingleInstance = GetOptionsMgr()->GetBool(OPT_SINGLE_INSTANCE) ||
+ bool bSingleInstance = GetOptionsMgr()->GetBool(OPT_SINGLE_INSTANCE) ||
(true == cmdInfo.m_bSingleInstance);
// Create exclusion mutex name
// Read last used filter from registry
// If filter fails to set, reset to default
const String filterString = m_pOptions->GetString(OPT_FILEFILTER_CURRENT);
- BOOL bFilterSet = m_pGlobalFileFilter->SetFilter(filterString);
+ bool bFilterSet = m_pGlobalFileFilter->SetFilter(filterString);
if (!bFilterSet)
{
String filter = m_pGlobalFileFilter->GetFilterNameOrMask();
// Since this function actually opens paths for compare it must be
// called after initializing CMainFrame!
- BOOL bContinue = TRUE;
- if (ParseArgsAndDoOpen(cmdInfo, pMainFrame) == FALSE && bCommandLineInvoke)
- bContinue = FALSE;
+ bool bContinue = true;
+ if (!ParseArgsAndDoOpen(cmdInfo, pMainFrame) && bCommandLineInvoke)
+ bContinue = false;
if (hMutex)
ReleaseMutex(hMutex);
// If user wants to cancel the compare, close WinMerge
- if (bContinue == FALSE)
+ if (!bContinue)
{
pMainFrame->PostMessage(WM_CLOSE, 0, 0);
}
*/
void CMergeApp::SetNeedIdleTimer()
{
- m_bNeedIdleTimer = TRUE;
+ m_bNeedIdleTimer = true;
}
bool CMergeApp::IsReallyIdle() const
// If anyone has requested notification when next idle occurs, send it
if (m_bNeedIdleTimer)
{
- m_bNeedIdleTimer = FALSE;
+ m_bNeedIdleTimer = false;
m_pMainWnd->SendMessageToDescendants(WM_TIMER, IDLE_TIMER, lCount, TRUE, FALSE);
}
* MergeCmdLineInfo class.
* @param [in] cmdInfo Commandline parameters info.
* @param [in] pMainFrame Pointer to application main frame.
- * @return TRUE if we opened the compare, FALSE if the compare was canceled.
+ * @return `true` if we opened the compare, `false` if the compare was canceled.
*/
-BOOL CMergeApp::ParseArgsAndDoOpen(MergeCmdLineInfo& cmdInfo, CMainFrame* pMainFrame)
+bool CMergeApp::ParseArgsAndDoOpen(MergeCmdLineInfo& cmdInfo, CMainFrame* pMainFrame)
{
- BOOL bCompared = FALSE;
+ bool bCompared = false;
String strDesc[3];
m_bNonInteractive = cmdInfo.m_bNonInteractive;
}
else if (cmdInfo.m_Files.GetSize() == 0) // if there are no input args, we can check the display file dialog flag
{
- BOOL showFiles = m_pOptions->GetBool(OPT_SHOW_SELECT_FILES_AT_STARTUP);
+ bool showFiles = m_pOptions->GetBool(OPT_SHOW_SELECT_FILES_AT_STARTUP);
if (showFiles)
pMainFrame->DoFileOpen();
}
sCmd += _T("\"");
}
- BOOL retVal = FALSE;
+ bool retVal = false;
STARTUPINFO stInfo = { sizeof STARTUPINFO };
PROCESS_INFORMATION processInfo;
- retVal = CreateProcess(NULL, (LPTSTR)sCmd.c_str(),
+ retVal = !!CreateProcess(NULL, (LPTSTR)sCmd.c_str(),
NULL, NULL, FALSE, CREATE_DEFAULT_ERROR_MODE, NULL, NULL,
&stInfo, &processInfo);
* succeeded or failed.
* @param [in] bFolder Are we creating backup in folder compare?
* @param [in] pszPath Full path to file to backup.
- * @return TRUE if backup succeeds, or isn't just done.
+ * @return `true` if backup succeeds, or isn't just done.
*/
-BOOL CMergeApp::CreateBackup(BOOL bFolder, const String& pszPath)
+bool CMergeApp::CreateBackup(bool bFolder, const String& pszPath)
{
// If user doesn't want to backups in folder compare, return
// success so operations don't abort.
if (bFolder && !(GetOptionsMgr()->GetBool(OPT_BACKUP_FOLDERCMP)))
- return TRUE;
+ return true;
// Likewise if user doesn't want backups in file compare
else if (!bFolder && !(GetOptionsMgr()->GetBool(OPT_BACKUP_FILECMP)))
- return TRUE;
+ return true;
// create backup copy of file if destination file exists
if (paths::DoesPathExist(pszPath) == paths::IS_EXISTING_FILE)
_RPTF0(_CRT_ERROR, "Unknown backup location!");
}
- BOOL success = FALSE;
+ bool success = false;
if (GetOptionsMgr()->GetBool(OPT_BACKUP_ADD_BAK))
{
// Don't add dot if there is no existing extension
if ((bakPath.length() + filename.length() + ext.length())
< MAX_PATH_FULL)
{
- success = TRUE;
+ success = true;
bakPath = paths::ConcatPath(bakPath, filename);
bakPath += _T(".");
bakPath += ext;
_("Unable to backup original file:\n%1\n\nContinue anyway?"),
pszPath);
if (AfxMessageBox(msg.c_str(), MB_YESNO | MB_ICONWARNING | MB_DONT_ASK_AGAIN) != IDYES)
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
// we got here because we're either not backing up of there was nothing to backup
- return TRUE;
+ return true;
}
/**
* @sa CMainFrame::SyncFileToVCS()
* @sa CMergeDoc::DoSave()
*/
-int CMergeApp::HandleReadonlySave(String& strSavePath, BOOL bMultiFile,
- BOOL &bApplyToAll)
+int CMergeApp::HandleReadonlySave(String& strSavePath, bool bMultiFile,
+ bool &bApplyToAll)
{
CFileStatus status;
int nRetVal = IDOK;
- BOOL bFileRO = FALSE;
- BOOL bFileExists = FALSE;
+ bool bFileRO = false;
+ bool bFileExists = false;
String s;
String str;
CString title;
case IDNO:
if (!bMultiFile)
{
- if (SelectFile(AfxGetMainWnd()->GetSafeHwnd(), s, FALSE, strSavePath.c_str()))
+ if (SelectFile(AfxGetMainWnd()->GetSafeHwnd(), s, false, strSavePath.c_str()))
{
strSavePath = s;
nRetVal = IDNO;
/**
* @brief Read project and perform comparison specified
* @param [in] sProject Full path to project file.
- * @return TRUE if loading project file and starting compare succeeded.
+ * @return `true` if loading project file and starting compare succeeded.
*/
bool CMergeApp::LoadAndOpenProjectFile(const String& sProject, const String& sReportFile)
{
return false;
PathContext tFiles;
- BOOL bLeftReadOnly = FALSE;
- BOOL bMiddleReadOnly = FALSE;
- BOOL bRightReadOnly = FALSE;
- bool bRecursive = FALSE;
+ bool bLeftReadOnly = false;
+ bool bMiddleReadOnly = false;
+ bool bRightReadOnly = false;
+ bool bRecursive = false;
project.GetPaths(tFiles, bRecursive);
bLeftReadOnly = project.GetLeftReadOnly();
bMiddleReadOnly = project.GetMiddleReadOnly();
GetOptionsMgr()->SaveOption(OPT_CMP_INCLUDE_SUBDIRS, bRecursive);
- BOOL rtn = GetMainFrame()->DoFileOpen(&tFiles, dwFlags, NULL, sReportFile, bRecursive);
+ bool rtn = GetMainFrame()->DoFileOpen(&tFiles, dwFlags, NULL, sReportFile, bRecursive);
AddToRecentProjectsMRU(sProject.c_str());
- return !!rtn;
+ return rtn;
}
/**
class CMergeApp : public CWinApp
{
public:
- BOOL m_bNeedIdleTimer;
+ bool m_bNeedIdleTimer;
CMultiDocTemplate* m_pOpenTemplate;
CMultiDocTemplate* m_pDiffTemplate;
CMultiDocTemplate* m_pHexMergeTemplate;
std::unique_ptr<SyntaxColors> m_pSyntaxColors; /**< Syntax color container */
std::unique_ptr<CCrystalTextMarkers> m_pMarkers; /**< Marker container */
String m_strSaveAsPath; /**< "3rd path" where output saved if given */
- BOOL m_bEscShutdown; /**< If commandline switch -e given ESC closes appliction */
+ bool m_bEscShutdown; /**< If commandline switch -e given ESC closes appliction */
SyntaxColors * GetMainSyntaxColors() { return m_pSyntaxColors.get(); }
CCrystalTextMarkers * GetMainMarkers() const { return m_pMarkers.get(); }
MergeCmdLineInfo::ExitNoDiff m_bExitIfNoDiff; /**< Exit if files are identical? */
void ShowHelp(LPCTSTR helpLocation = NULL);
void OpenFileToExternalEditor(const String& file, int nLineNumber = 1);
void OpenFileOrUrl(LPCTSTR szFile, LPCTSTR szUrl);
- BOOL CreateBackup(BOOL bFolder, const String& pszPath);
- int HandleReadonlySave(String& strSavePath, BOOL bMultiFile, BOOL &bApplyToAll);
+ bool CreateBackup(bool bFolder, const String& pszPath);
+ int HandleReadonlySave(String& strSavePath, bool bMultiFile, bool &bApplyToAll);
bool GetMergingMode() const;
void SetMergingMode(bool bMergingMode);
void SetupTempPath();
//}}AFX_VIRTUAL
void InitializeFileFilters();
- BOOL ParseArgsAndDoOpen(MergeCmdLineInfo& cmdInfo, CMainFrame* pMainFrame);
+ bool ParseArgsAndDoOpen(MergeCmdLineInfo& cmdInfo, CMainFrame* pMainFrame);
void UpdateDefaultCodepage(int cpDefaultMode, int cpCustomCodepage);
void UpdateCodepageModule();
void ApplyCommandLineConfigOptions(MergeCmdLineInfo & cmdInfo);
}
m_diffWrapper.SetCreateDiffList(&m_diffList);
- diffSuccess = !!m_diffWrapper.RunFileDiff();
+ diffSuccess = m_diffWrapper.RunFileDiff();
// Read diff-status
m_diffWrapper.GetDiffStatus(&status);
DiffList templist;
templist.Clear();
m_diffWrapper.SetCreateDiffList(&templist);
- diffSuccess = !!m_diffWrapper.RunFileDiff();
+ diffSuccess = m_diffWrapper.RunFileDiff();
for (nBuffer = 0; nBuffer < m_nBuffers; nBuffer++)
nRealLine[nBuffer] = m_ptBuf[nBuffer]->ComputeRealLine(nStartLine[nBuffer]);
m_diffList.AppendDiffList(templist, nRealLine);
DiffFileInfo fileInfo;
String strSavePath(szPath);
FileChange fileChanged;
- BOOL bApplyToAll = false;
+ bool bApplyToAll = false;
int nRetVal = -1;
fileChanged = IsFileChangedOnDisk(szPath, fileInfo, true, nBuffer);
{
CView::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
- BOOL bSplitVert = !GetOptionsMgr()->GetBool(OPT_SPLIT_HORIZONTALLY);
+ bool bSplitVert = !GetOptionsMgr()->GetBool(OPT_SPLIT_HORIZONTALLY);
if (m_bDetailView)
bSplitVert = !bSplitVert;
}
}
- m_wndSplitter.ResizablePanes(TRUE);
+ m_wndSplitter.ResizablePanes(true);
m_wndSplitter.AutoResizePanes(GetOptionsMgr()->GetBool(OPT_RESIZE_PANES));
m_nThisGroup = pDoc->m_nGroups;
/**
* @brief Update other panes
*/
-void CMergeEditView::OnUpdateSibling (CCrystalTextView * pUpdateSource, BOOL bHorz)
+void CMergeEditView::OnUpdateSibling (CCrystalTextView * pUpdateSource, bool bHorz)
{
if (pUpdateSource != this)
{
/// active prediffer ID : helper to check the radio button
int m_CurrentPredifferID;
- bool m_bCurrentLineIsDiff; /**< TRUE if cursor is in diff line */
+ bool m_bCurrentLineIsDiff; /**< `true` if cursor is in diff line */
// Operations
public:
CMergeDoc* GetDocument();
const CMergeDoc *GetDocument() const { return const_cast<CMergeEditView *>(this)->GetDocument(); }
void UpdateResources();
- BOOL IsModified() { return (LocateTextBuffer()->IsModified()); }
+ bool IsModified() { return (LocateTextBuffer()->IsModified()); }
void PrimeListWithFile();
void SetStatusInterface(IMergeEditStatus * piMergeEditStatus);
void SelectArea(const CPoint & ptStart, const CPoint & ptEnd) { SetSelection(ptStart, ptEnd); } // make public
// Implementation
protected:
virtual ~CMergeEditView();
- virtual void OnUpdateSibling (CCrystalTextView * pUpdateSource, BOOL bHorz);
+ virtual void OnUpdateSibling (CCrystalTextView * pUpdateSource, bool bHorz);
virtual void OnUpdateCaret();
bool MergeModeKeyDown(MSG* pMsg);
int FindPrediffer(LPCTSTR prediffer) const;
m_ctlPath[2].AttachSystemImageList();
LoadComboboxStates();
- BOOL bDoUpdateData = TRUE;
+ bool bDoUpdateData = true;
for (int index = 0; index < countof(m_strPath); index++)
{
if (!m_strPath[index].empty())
- bDoUpdateData = FALSE;
+ bDoUpdateData = false;
}
UpdateData(bDoUpdateData);
String filterNameOrMask = theApp.m_pGlobalFileFilter->GetFilterNameOrMask();
- BOOL bMask = theApp.m_pGlobalFileFilter->IsUsingMask();
+ bool bMask = theApp.m_pGlobalFileFilter->IsUsingMask();
if (!bMask)
{
UpdateButtonStates();
- BOOL bOverwriteRecursive = FALSE;
+ bool bOverwriteRecursive = false;
if (m_dwFlags[0] & FFILEOPEN_PROJECT || m_dwFlags[1] & FFILEOPEN_PROJECT)
- bOverwriteRecursive = TRUE;
+ bOverwriteRecursive = true;
if (m_dwFlags[0] & FFILEOPEN_CMDLINE || m_dwFlags[1] & FFILEOPEN_CMDLINE)
- bOverwriteRecursive = TRUE;
+ bOverwriteRecursive = true;
if (!bOverwriteRecursive)
m_bRecurse = GetOptionsMgr()->GetBool(OPT_CMP_INCLUDE_SUBDIRS);
}
else
{
- BOOL bFilterSet = theApp.m_pGlobalFileFilter->SetFilter(filter);
+ bool bFilterSet = theApp.m_pGlobalFileFilter->SetFilter(filter);
if (!bFilterSet)
m_strExt = theApp.m_pGlobalFileFilter->GetFilterNameOrMask();
GetOptionsMgr()->SaveOption(OPT_FILEFILTER_CURRENT, filter);
PackingInfo tmpPackingInfo(pDoc->m_infoHandler);
GetMainFrame()->DoFileOpen(
&tmpPathContext, std::array<DWORD, 3>(pDoc->m_dwFlags).data(),
- NULL, _T(""), !!pDoc->m_bRecurse, NULL, _T(""), &tmpPackingInfo);
+ NULL, _T(""), pDoc->m_bRecurse, NULL, _T(""), &tmpPackingInfo);
}
/**
if (msg.message != WM_USER + 2)
continue;
- BOOL bButtonEnabled = TRUE;
- BOOL bInvalid[3] = {FALSE, FALSE, FALSE};
+ bool bButtonEnabled = true;
+ bool bInvalid[3] = {false, false, false};
int iStatusMsgId = 0;
int iUnpackerStatusMsgId = 0;
delete pParams;
// Check if we have project file as left side path
- BOOL bProject = FALSE;
+ bool bProject = false;
String ext;
paths::SplitFilename(paths[0], NULL, NULL, &ext);
if (paths[1].empty() && strutils::compare_nocase(ext, ProjectFile::PROJECTFILE_EXT) == 0)
- bProject = TRUE;
+ bProject = true;
if (!bProject)
{
if (paths::DoesPathExist(paths[0], IsArchiveFile) == paths::DOES_NOT_EXIST)
- bInvalid[0] = TRUE;
+ bInvalid[0] = true;
if (paths::DoesPathExist(paths[1], IsArchiveFile) == paths::DOES_NOT_EXIST)
- bInvalid[1] = TRUE;
+ bInvalid[1] = true;
if (paths.GetSize() > 2 && paths::DoesPathExist(paths[2], IsArchiveFile) == paths::DOES_NOT_EXIST)
- bInvalid[2] = TRUE;
+ bInvalid[2] = true;
}
// Enable buttons as appropriate
iUnpackerStatusMsgId = IDS_OPEN_UNPACKERDISABLED;
if (bProject)
- bButtonEnabled = TRUE;
+ bButtonEnabled = true;
else
bButtonEnabled = (pathsType != paths::DOES_NOT_EXIST);
}
String filterPrefix = _("[F] ");
String curFilter;
- const BOOL bUseMask = theApp.m_pGlobalFileFilter->IsUsingMask();
+ const bool bUseMask = theApp.m_pGlobalFileFilter->IsUsingMask();
GetDlgItemText(IDC_EXT_COMBO, curFilter);
curFilter = strutils::trim_ws(curFilter);
* project file are kept in memory and used later when loading paths
* selected.
* @param [in] path Path to the project file.
- * @return TRUE if the project file was successfully loaded, FALSE otherwise.
+ * @return `true` if the project file was successfully loaded, `false` otherwise.
*/
-BOOL COpenView::LoadProjectFile(const String &path)
+bool COpenView::LoadProjectFile(const String &path)
{
String filterPrefix = _("[F] ");
ProjectFile prj;
protected:
void SetStatus(UINT msgID);
void SetUnpackerStatus(UINT msgID);
- BOOL LoadProjectFile(const String &path);
+ bool LoadProjectFile(const String &path);
void TerminateThreadIfRunning();
void TrimPaths();
void OnButton(int index);
pSyntaxColors->SetColor(i, ref);
valuename = strutils::format(_T("%s/Bold%02u"), DefColorsPath, i);
- bool bBold = pSyntaxColors->GetBold(i);
- pOptionsMgr->InitOption(valuename, bBold);
- int nBold = pOptionsMgr->GetBool(valuename);
- bBold = nBold ? true : false;
- pSyntaxColors->SetBold(i, bBold);
+ pOptionsMgr->InitOption(valuename, pSyntaxColors->GetBold(i));
+ pSyntaxColors->SetBold(i, pOptionsMgr->GetBool(valuename));
}
}
m_ctlResult.SetWindowText(m_fileResult.c_str());
DeleteFile(m_fileResult.c_str());
}
- if (paths::IsPathAbsolute(m_fileResult) == FALSE)
+ if (!paths::IsPathAbsolute(m_fileResult))
{
String msg = strutils::format_string1(_("The specified output path is not an absolute path: %1"),
m_fileResult);
String folder;
folder = m_file1;
- if (SelectFile(GetSafeHwnd(), s, TRUE, folder.c_str()))
+ if (SelectFile(GetSafeHwnd(), s, true, folder.c_str()))
m_ctlFile1.SetWindowText(s.c_str());
}
String folder;
folder = m_file2;
- if (SelectFile(GetSafeHwnd(), s, TRUE, folder.c_str()))
+ if (SelectFile(GetSafeHwnd(), s, true, folder.c_str()))
m_ctlFile2.SetWindowText(s.c_str());
}
String folder;
folder = m_fileResult;
- if (SelectFile(GetSafeHwnd(), s, FALSE, folder.c_str()))
+ if (SelectFile(GetSafeHwnd(), s, false, folder.c_str()))
m_ctlResult.SetWindowText(s.c_str());
}
/**
* @brief Show patch options dialog and check options selected.
- * @return TRUE if user wants to create a patch (didn't cancel dialog).
+ * @return `true` if user wants to create a patch (didn't cancel dialog).
*/
bool CPatchTool::ShowDialog(CPatchDlg *pDlgPatch)
{
patchOptions.nContext = pDlgPatch->m_contextLines;
// Checkbox - can't be wrong
- patchOptions.bAddCommandline = !!pDlgPatch->m_includeCmdLine;
+ patchOptions.bAddCommandline = pDlgPatch->m_includeCmdLine;
m_diffWrapper.SetPatchOptions(&patchOptions);
// These are from checkboxes and radiobuttons - can't be wrong
{
public:
PluginInfo()
- : m_lpDispatch(NULL), m_filters(NULL), m_bAutomatic(FALSE), m_nFreeFunctions(0), m_disabled(false)
+ : m_lpDispatch(NULL), m_filters(NULL), m_bAutomatic(false), m_nFreeFunctions(0), m_disabled(false)
{
}
void PropArchive::WriteOptions()
{
GetOptionsMgr()->SaveOption(OPT_ARCHIVE_ENABLE, (int)(m_bEnableSupport ? 1 : 0));
- GetOptionsMgr()->SaveOption(OPT_ARCHIVE_PROBETYPE, m_bProbeType == TRUE);
+ GetOptionsMgr()->SaveOption(OPT_ARCHIVE_PROBETYPE, m_bProbeType);
}
/**
}
wnd.Create(_T("heksedit"), NULL, 0, CRect(), pwndParent, 1);
get_interface()->read_ini_data();
- get_interface()->get_settings()->bSaveIni = TRUE;
+ get_interface()->get_settings()->bSaveIni = true;
}
IHexEditorWindow *get_interface()
GetOptionsMgr()->SaveOption(OPT_AUTOMATIC_RESCAN, m_bAutomaticRescan);
GetOptionsMgr()->SaveOption(OPT_ALLOW_MIXED_EOL, m_bAllowMixedEol);
GetOptionsMgr()->SaveOption(OPT_SYNTAX_HIGHLIGHT, m_bHiliteSyntax);
- GetOptionsMgr()->SaveOption(OPT_WORDDIFF_HIGHLIGHT, !!m_bViewLineDifferences);
- GetOptionsMgr()->SaveOption(OPT_BREAK_ON_WORDS, !!m_bBreakOnWords);
+ GetOptionsMgr()->SaveOption(OPT_WORDDIFF_HIGHLIGHT, m_bViewLineDifferences);
+ GetOptionsMgr()->SaveOption(OPT_BREAK_ON_WORDS, m_bBreakOnWords);
GetOptionsMgr()->SaveOption(OPT_BREAK_TYPE, m_nBreakType);
GetOptionsMgr()->SaveOption(OPT_BREAK_SEPARATORS, String(m_breakChars));
}
{
UpdateDataFromWindow();
// Can only choose char/word level if line differences are enabled
- EnableDlgItem(IDC_EDITOR_CHARLEVEL, !!m_bViewLineDifferences);
- EnableDlgItem(IDC_EDITOR_WORDLEVEL, !!m_bViewLineDifferences);
+ EnableDlgItem(IDC_EDITOR_CHARLEVEL, m_bViewLineDifferences);
+ EnableDlgItem(IDC_EDITOR_WORDLEVEL, m_bViewLineDifferences);
// Can only choose break type if line differences are enabled & we're breaking on words
- EnableDlgItem(IDC_BREAK_TYPE, !!m_bViewLineDifferences);
+ EnableDlgItem(IDC_BREAK_TYPE, m_bViewLineDifferences);
}
/**
*/
void PropRegistry::WriteOptions()
{
- GetOptionsMgr()->SaveOption(OPT_USE_RECYCLE_BIN, m_bUseRecycleBin == TRUE);
+ GetOptionsMgr()->SaveOption(OPT_USE_RECYCLE_BIN, m_bUseRecycleBin);
String sExtEditor = strutils::trim_ws(m_strEditorPath);
if (sExtEditor.empty())
void PropRegistry::OnBrowseEditor()
{
String path;
- if (SelectFile(GetSafeHwnd(), path, TRUE, m_strEditorPath.c_str(), _T(""), _("Programs|*.exe;*.bat;*.cmd|All Files (*.*)|*.*||")))
+ if (SelectFile(GetSafeHwnd(), path, true, m_strEditorPath.c_str(), _T(""), _("Programs|*.exe;*.bat;*.cmd|All Files (*.*)|*.*||")))
{
SetDlgItemText(IDC_EXT_EDITOR_PATH, path);
}
success = !!DeleteFile(m_path.c_str());
if (success)
m_path = _T("");
- return !!success;
+ return success;
}
/**
* @brief Cleanup tempfiles created by WinMerge.
paths::ConcatPath(projectRoot, L"Testing/Data/Unicode/UCS-2BE/DiffItem.h"),\r
paths::ConcatPath(projectRoot, L"Testing/Data/Unicode/UCS-2LE/DiffItem.h")\r
};\r
- EXPECT_TRUE(!!GetMainFrame()->DoFileOpen(&tFiles));\r
+ EXPECT_TRUE(GetMainFrame()->DoFileOpen(&tFiles));\r
CFrameWnd *pFrame = GetMainFrame()->GetActiveFrame();\r
CMergeDoc *pDoc = dynamic_cast<CMergeDoc *>(pFrame->GetActiveDocument());\r
ASSERT_NE(nullptr, pDoc);\r
paths::ConcatPath(projectRoot, L"Testing/Data/Unicode/UTF-8/DiffItem.h"),\r
paths::ConcatPath(projectRoot, L"Testing/Data/Unicode/UTF-8-NOBOM/DiffItem.h")\r
};\r
- EXPECT_TRUE(!!GetMainFrame()->DoFileOpen(&tFiles));\r
+ EXPECT_TRUE(GetMainFrame()->DoFileOpen(&tFiles));\r
CFrameWnd *pFrame = GetMainFrame()->GetActiveFrame();\r
CMergeDoc *pDoc = dynamic_cast<CMergeDoc *>(pFrame->GetActiveDocument());\r
EXPECT_NE(nullptr, pDoc);\r
};\r
CMessageBoxDialog dlg(nullptr, IDS_FILESSAME, 0U, 0U, IDS_FILESSAME);\r
const int nPrevFormerResult = dlg.SetFormerResult(IDOK);\r
- EXPECT_TRUE(!!GetMainFrame()->DoFileOpen(&tFiles));\r
+ EXPECT_TRUE(GetMainFrame()->DoFileOpen(&tFiles));\r
CFrameWnd *pFrame = GetMainFrame()->GetActiveFrame();\r
CMergeDoc *pDoc = dynamic_cast<CMergeDoc *>(pFrame->GetActiveDocument());\r
EXPECT_NE(nullptr, pDoc);\r
{\r
GetOptionsMgr()->Set(OPT_CMP_METHOD, 0/* Full Contents*/);\r
GetOptionsMgr()->Set(OPT_CMP_IGNORE_EOL, true);\r
- EXPECT_TRUE(!!GetMainFrame()->DoFileOpen(&dirs));\r
+ EXPECT_TRUE(GetMainFrame()->DoFileOpen(&dirs));\r
CFrameWnd *pFrame = GetMainFrame()->GetActiveFrame();\r
CDirDoc *pDoc = dynamic_cast<CDirDoc *>(pFrame->GetActiveDocument());\r
EXPECT_NE(nullptr, pDoc);\r
};\r
CMessageBoxDialog dlg(nullptr, IDS_FILESSAME, 0U, 0U, IDS_FILESSAME);\r
const int nPrevFormerResult = dlg.SetFormerResult(IDOK);\r
- EXPECT_TRUE(!!GetMainFrame()->DoFileOpen(&tFiles));\r
+ EXPECT_TRUE(GetMainFrame()->DoFileOpen(&tFiles));\r
CFrameWnd *pFrame = GetMainFrame()->GetActiveFrame();\r
CImgMergeFrame *pDoc = dynamic_cast<CImgMergeFrame *>(pFrame);\r
EXPECT_NE(nullptr, pDoc);\r
osvi.dwMinorVersion = LOBYTE(wVersion);
osvi.wServicePackMajor = wServicePack;
- return VerifyVersionInfoW(&osvi, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR, dwlConditionMask) != FALSE;
+ return !!VerifyVersionInfoW(&osvi, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR, dwlConditionMask);
}
/**
* @brief Throw DLLPSTUB related exception.
*/
-void DLLPSTUB::Throw(LPCSTR name, HMODULE handle, DWORD dwError, BOOL bFreeLibrary)
+void DLLPSTUB::Throw(LPCSTR name, HMODULE handle, DWORD dwError, bool bFreeLibrary)
{
CString strError = name;
if (handle)
// Well, that's the most appropriate canned system
// message I came across: If DLL is outdated, it may
// actually lack some interface we need...
- Throw(0, handle, CO_S_NOTALLINTERFACES, TRUE);
+ Throw(0, handle, CO_S_NOTALLINTERFACES, true);
}
}
LPCSTR *pszExport = proxy;
dwError = ERROR_PROC_NOT_FOUND;
handle1 = (HMODULE)proxy[2];
}
- Throw(name, handle1, dwError, FALSE);
+ Throw(name, handle1, dwError, false);
}
}
return handle;
DWORD dwMinorVersion; // Minor version
DWORD dwBuildNumber; // Build number
DWORD dwPadding; // Pad to 64 bit boundary
- static void Throw(LPCSTR name, HMODULE, DWORD dwError, BOOL bFreeLibrary);
+ static void Throw(LPCSTR name, HMODULE, DWORD dwError, bool bFreeLibrary);
HMODULE Load();
};
int iBytesPerLine; /**< How many bytes in one line in hex view. */\r
int iAutomaticBPL; /**< Add max amount of bytes that fit to view. */\r
BYTE_ENDIAN iBinaryMode; /**< Binary mode, little/big endian. */\r
- int bReadOnly; /**< Is editor in read-only mode? */\r
- int bSaveIni; /**< Save INI file when required. */\r
+ bool bReadOnly; /**< Is editor in read-only mode? */\r
+ bool bSaveIni; /**< Save INI file when required. */\r
int iFontSize;\r
int iCharacterSet; /**< Use OEM or ANSI character set? */\r
int iMinOffsetLen; /**< Minimum numbers used in offset. */\r
int iMaxOffsetLen; /**< Maximum numbers used in offset. */\r
- int bAutoOffsetLen; /**< Determine offset length automatically. */\r
- int bCenterCaret;\r
int iFontZoom;\r
};\r
\r
struct Status\r
{\r
- int iFileChanged;\r
+ bool bFileChanged;\r
int const(iEnteringMode);\r
int const(iCurByte);\r
int const(iCurNibble);\r