More of the same...
void CCrystalTextBuffer::
GetText (int nStartLine, int nStartChar, int nEndLine, int nEndChar,
- CString & text, LPCTSTR pszCRLF /*= NULL*/, bool bExcludeInvisibleLines/*= true*/) const
+ CString & text, LPCTSTR pszCRLF /*= nullptr*/, bool bExcludeInvisibleLines/*= true*/) const
{
ASSERT (m_bInit); // Text buffer not yet initialized.
// You must call InitNew() or LoadFromFile() first!
}
POSITION CCrystalTextBuffer::
-GetUndoActionCode (int & nAction, POSITION pos /*= NULL*/ ) const
+GetUndoActionCode (int & nAction, POSITION pos /*= nullptr*/ ) const
{
ASSERT (CanUndo ()); // Please call CanUndo() first
}
POSITION CCrystalTextBuffer::
-GetRedoActionCode (int & nAction, POSITION pos /*= NULL*/ ) const
+GetRedoActionCode (int & nAction, POSITION pos /*= nullptr*/ ) const
{
ASSERT (CanRedo ()); // Please call CanRedo() before!
ASSERT ((m_aUndoBuf[m_nUndoPosition].m_dwFlags & UNDO_BEGINGROUP) != 0);
intptr_t nPosition;
- if (pos == NULL)
+ if (pos == nullptr)
{
// Start from beginning
nPosition = m_nUndoPosition;
}
POSITION CCrystalTextBuffer::
-GetUndoDescription (CString & desc, POSITION pos /*= NULL*/ ) const
+GetUndoDescription (CString & desc, POSITION pos /*= nullptr*/ ) const
{
int nAction;
POSITION retValue = GetUndoActionCode(nAction, pos);
}
POSITION CCrystalTextBuffer::
-GetRedoDescription (CString & desc, POSITION pos /*= NULL*/ ) const
+GetRedoDescription (CString & desc, POSITION pos /*= nullptr*/ ) const
{
int nAction;
POSITION retValue = GetRedoActionCode(nAction, pos);
void CCrystalTextBuffer:: /* virtual base */
AddUndoRecord (bool bInsert, const CPoint & ptStartPos,
- const CPoint & ptEndPos, LPCTSTR pszText, size_t cchText, int nActionType,
- CDWordArray *paSavedRevisionNumbers)
+ const CPoint & ptEndPos, LPCTSTR pszText, size_t cchText, int nActionType /*= CE_ACTION_UNKNOWN*/,
+ CDWordArray *paSavedRevisionNumbers /*= nullptr*/)
{
// Forgot to call BeginUndoGroup()?
ASSERT (m_bUndoGroup);
// [JRT] Support For Descriptions On Undo/Redo Actions
virtual void AddUndoRecord (bool bInsert, const CPoint & ptStartPos, const CPoint & ptEndPos,
- LPCTSTR pszText, size_t cchText, int nActionType = CE_ACTION_UNKNOWN, CDWordArray *paSavedRevisionNumbers = NULL);
+ LPCTSTR pszText, size_t cchText, int nActionType = CE_ACTION_UNKNOWN, CDWordArray *paSavedRevisionNumbers = nullptr);
virtual UndoRecord GetUndoRecord (int nUndoPos) const;
virtual CDWordArray *CopyRevisionNumbers(int nStartLine, int nEndLine) const;
void SetLineFlag (int nLine, DWORD dwFlag, bool bSet,
bool bRemoveFromPreviousLine = true, bool bUpdate=true);
void GetText (int nStartLine, int nStartChar, int nEndLine, int nEndChar,
- CString & text, LPCTSTR pszCRLF = NULL, bool bExcludeInvisibleLines = true) const;
+ CString & text, LPCTSTR pszCRLF = nullptr, bool bExcludeInvisibleLines = true) const;
virtual void GetTextWithoutEmptys (int nStartLine, int nStartChar,
int nEndLine, int nEndChar, CString &text,
CRLFSTYLE nCrlfStyle = CRLF_STYLE_AUTOMATIC, bool bExcludeInvisibleLines = true) const;
// Browse undo sequence
- POSITION GetUndoActionCode (int & nAction, POSITION pos = NULL) const;
- POSITION GetRedoActionCode (int & nAction, POSITION pos = NULL) const;
- POSITION GetUndoDescription (CString & desc, POSITION pos = NULL) const;
- POSITION GetRedoDescription (CString & desc, POSITION pos = NULL) const;
+ POSITION GetUndoActionCode (int & nAction, POSITION pos = nullptr) const;
+ POSITION GetRedoActionCode (int & nAction, POSITION pos = nullptr) const;
+ POSITION GetUndoDescription (CString & desc, POSITION pos = nullptr) const;
+ POSITION GetRedoDescription (CString & desc, POSITION pos = nullptr) const;
// Notify all connected views about changes in name of file
CCrystalTextView::TextDefinition *RetypeViews (LPCTSTR lpszFileName);
// CCrystalTextView printing
void CCrystalTextView::
-OnPrepareDC (CDC * pDC, CPrintInfo * pInfo)
+OnPrepareDC (CDC * pDC, CPrintInfo * pInfo /*= nullptr*/)
{
CView::OnPrepareDC (pDC, pInfo);
- if (pInfo != NULL)
+ if (pInfo != nullptr)
{
pInfo->m_bContinuePrinting = true;
if (m_nPrintPages != 0 && (int) pInfo->m_nCurPage > m_nPrintPages)
LPCTSTR CCrystalTextView::
GetLineChars (int nLineIndex) const
{
- if (m_pTextBuffer == NULL)
- return NULL;
+ if (m_pTextBuffer == nullptr)
+ return nullptr;
return m_pTextBuffer->GetLineChars (nLineIndex);
}
* no need to reset the editor options (m_bOvrMode, m_bLastReplace)
*/
void CCrystalTextView::
-ReAttachToBuffer (CCrystalTextBuffer * pBuf /*= NULL*/ )
+ReAttachToBuffer (CCrystalTextBuffer * pBuf /*= nullptr*/ )
{
- if (m_pTextBuffer != NULL)
+ if (m_pTextBuffer != nullptr)
m_pTextBuffer->RemoveView (this);
- if (pBuf == NULL)
+ if (pBuf == nullptr)
{
pBuf = LocateTextBuffer ();
// ...
}
m_pTextBuffer = pBuf;
- if (m_pTextBuffer != NULL)
+ if (m_pTextBuffer != nullptr)
m_pTextBuffer->AddView (this);
// don't reset CCrystalEditView options
CCrystalTextView::ResetView ();
// Init scrollbars arrows
CScrollBar *pVertScrollBarCtrl = GetScrollBarCtrl (SB_VERT);
- if (pVertScrollBarCtrl != NULL)
+ if (pVertScrollBarCtrl != nullptr)
pVertScrollBarCtrl->EnableScrollBar (GetScreenLines () >= GetLineCount ()?
ESB_DISABLE_BOTH : ESB_ENABLE_BOTH);
// Update vertical scrollbar only
* initialize the view and initialize both scrollbars
*/
void CCrystalTextView::
-AttachToBuffer (CCrystalTextBuffer * pBuf /*= NULL*/ )
+AttachToBuffer (CCrystalTextBuffer * pBuf /*= nullptr*/ )
{
- if (m_pTextBuffer != NULL)
+ if (m_pTextBuffer != nullptr)
m_pTextBuffer->RemoveView (this);
- if (pBuf == NULL)
+ if (pBuf == nullptr)
{
pBuf = LocateTextBuffer ();
// ...
}
m_pTextBuffer = pBuf;
- if (m_pTextBuffer != NULL)
+ if (m_pTextBuffer != nullptr)
m_pTextBuffer->AddView (this);
ResetView ();
// Init scrollbars
CScrollBar *pVertScrollBarCtrl = GetScrollBarCtrl (SB_VERT);
- if (pVertScrollBarCtrl != NULL)
+ if (pVertScrollBarCtrl != nullptr)
pVertScrollBarCtrl->EnableScrollBar (GetScreenLines () >= GetLineCount ()?
ESB_DISABLE_BOTH : ESB_ENABLE_BOTH);
CScrollBar *pHorzScrollBarCtrl = GetScrollBarCtrl (SB_HORZ);
- if (pHorzScrollBarCtrl != NULL)
+ if (pHorzScrollBarCtrl != nullptr)
pHorzScrollBarCtrl->EnableScrollBar (GetScreenChars () >= GetMaxLineLength (m_nTopLine, GetScreenLines())?
ESB_DISABLE_BOTH : ESB_ENABLE_BOTH);
* @return Margin area width in pixels.
*/
int CCrystalTextView::
-GetMarginWidth (CDC *pdc)
+GetMarginWidth (CDC *pdc /*= nullptr*/)
{
int nMarginWidth = 0;
if (m_bSelMargin)
{
- if (pdc == NULL || !pdc->IsPrinting ())
+ if (pdc == nullptr || !pdc->IsPrinting ())
nMarginWidth += MARGIN_ICON_WIDTH + 7; // Width for icon markers and some margin
}
else
{
- if (pdc == NULL || !pdc->IsPrinting ())
+ if (pdc == nullptr || !pdc->IsPrinting ())
nMarginWidth += MARGIN_REV_WIDTH; // Space for revision marks
}
CPoint m_ptDraggedTextBegin, m_ptDraggedTextEnd;
void UpdateCaret ();
void SetAnchor (const CPoint & ptNewAnchor);
- int GetMarginWidth (CDC *pdc = NULL);
+ int GetMarginWidth (CDC *pdc = nullptr);
bool IsValidTextPos (const CPoint &point);
bool IsValidTextPosX (const CPoint &point);
bool IsValidTextPosY (const CPoint &point);
not exceed (except whitespaces)
@param anBreaks An array of integers. Put the positions where to wrap the line
- in that array (its allready allocated). If this pointer is NULL, the function
+ in that array (its allready allocated). If this pointer is `nullptr`, the function
has only to compute the number of breaks (the parameter nBreaks).
@param nBreaks The number of breaks this line has (number of sublines - 1). When
method). This function uses an internal cache which contains the number
of sublines for each line, so it has only to call WrapLine(), if the
cache for the given line is invalid or if the caller wants to get the
- wrap postions (anBreaks != NULL).
+ wrap postions (anBreaks != nullptr).
This functions also tests m_bWordWrap -- you can call it even if
word wrapping is disabled and you will retrieve a valid value.
not exceed (except whitespaces)
@param anBreaks An array of integers. Put the positions where to wrap the line
- in that array (its allready allocated). If this pointer is NULL, the function
+ in that array (its allready allocated). If this pointer is `nullptr`, the function
has only to compute the number of breaks (the parameter nBreaks).
@param nBreaks The number of breaks this line has (number of sublines - 1). When
/**
Sets the Parser to use to parse the file.
- @param pParser Pointer to parser to use. Set to NULL to use no parser.
+ @param pParser Pointer to parser to use. Set to `nullptr` to use no parser.
- @return Pointer to parser used before or NULL, if no parser has been used before.
+ @return Pointer to parser used before or `nullptr`, if no parser has been used before.
*/
CCrystalParser *SetParser( CCrystalParser *pParser );
//END SW
// Operations
public :
- virtual void ReAttachToBuffer (CCrystalTextBuffer * pBuf = NULL);
- virtual void AttachToBuffer (CCrystalTextBuffer * pBuf = NULL);
+ virtual void ReAttachToBuffer (CCrystalTextBuffer * pBuf = nullptr);
+ virtual void AttachToBuffer (CCrystalTextBuffer * pBuf = nullptr);
virtual void DetachFromBuffer ();
// Buffer-view interaction, multiple views
virtual BOOL PreCreateWindow (CREATESTRUCT & cs);
virtual BOOL PreTranslateMessage (MSG * pMsg);
- virtual void OnPrepareDC (CDC * pDC, CPrintInfo * pInfo = NULL);
+ virtual void OnPrepareDC (CDC * pDC, CPrintInfo * pInfo = nullptr);
virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO *pHandlerInfo);
protected :
virtual void OnInitialUpdate (); // called first time after construct
CCrystalEditViewEx::CCrystalEditViewEx()
: CCrystalEditView()
{
- m_pSyntaxParser = NULL;
+ m_pSyntaxParser = nullptr;
}
DWORD CCrystalEditViewEx::ParseLine( DWORD dwCookie, int nLineIndex,
TEXTBLOCK *pBuf, int &nActualItems )
{
- if( m_pSyntaxParser )
+ if( m_pSyntaxParser != nullptr )
{
CCrystalTextBlock *pTextBlock =
pBuf? new CCrystalTextBlock( (CCrystalTextBlock::TEXTBLOCK*)pBuf, nActualItems ) : NULL;
m_pSyntaxParser = pParser;
- if( pParser )
+ if( pParser != nullptr )
//BEGIN FP
pParser->m_pTextView = this;
/*ORIGINAL
\r
@return\r
The syntax parser that was used until the call to this function or\r
- NULL if no one was attached to this view.\r
+ `nullptr` if no one was attached to this view.\r
*/\r
CCrystalParser *SetSyntaxParser( CCrystalParser *pParser );\r
\r
color. You have to specifie each one of this blocks in this Buffer.\r
You can define a new Block with the macro DEFINE_BLOCK( pos, colorindex ).\r
\r
- When the function ist called with this parameter set zu NULL, you only\r
+ When the function is called with this parameter set to `nullptr`, you only\r
have to calculate the cookies.\r
@param nActualItems\r
Used by the macro DEFINE_BLOCK.\r
protected:\r
/**\r
@description\r
- The parser used to parse the Text or NULL if no parser is used.\r
+ The parser used to parse the Text or `nullptr` if no parser is used.\r
*/\r
CCrystalParser *m_pSyntaxParser;\r
};\r
this block array, using CTextBlock::Add(). You do not have to care about
the sort to add the elements.
- When the function ist called with this parameter set zu NULL, you only
+ When the function is called with this parameter set to `nullptr`, you only
have to calculate the cookies which can be (hoply) done much more faster.
@return The calculated flags for this line (see dwCookie).
not exceed
@param anBreaks An array of integers. Put the positions where to wrap the line
- in that array (its allready allocated). If this pointer is NULL, the function
+ in that array (its allready allocated). If this pointer is `nullptr`, the function
has only to compute the number of breaks (the parameter nBreaks).
@param nBreaks The number of breaks this line has (number of sublines - 1). When
}
/* connect to registry key */
-HKEY CReg::Open (HKEY hNewKey /*= NULL*/)
+HKEY CReg::Open (HKEY hNewKey /*= nullptr*/)
{
return hKey = hNewKey;
}
/* close computer registry */
void CReg::Close ()
{
- if (hKey != NULL) // MAB 8 Nov 1999 - added NULL test
+ if (hKey != nullptr) // MAB 8 Nov 1999 - added NULL test
{
RegClose (hKey);
//*** MIPO 07-12-1999 - After Closing the Key, hKey must by NULL ****
// RegClose - dont do that - it must be done manualy
- hKey = NULL;
+ hKey = nullptr;
}
}
HKEY Connect (HKEY hNewKey, LPCTSTR pszRemote);
/* connect to registry key */
- HKEY Open (HKEY hNewKey = NULL);
+ HKEY Open (HKEY hNewKey = nullptr);
/* open computer registry */
HKEY Open (HKEY hNewKey, LPCTSTR pszSubKey, DWORD dwRights);
//////////////////
// 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 /*= CRect(0,0,0,0)*/, LPCRECT prcMFBounds /*= nullptr*/) const
{
ASSERT(pDC != nullptr);
//////////////////
// Get image size in pixels. Converts from HIMETRIC to device coords.
//
-CSize CPicture::GetImageSize(CDC* pDC) const
+CSize CPicture::GetImageSize(CDC* pDC /*= nullptr*/) const
{
- if (!m_spIPicture)
+ if (m_spIPicture == nullptr)
return CSize(0,0);
LONG hmWidth, hmHeight; // HIMETRIC units
if (FAILED(m_spIPicture->get_Width(&hmWidth)) || FAILED(m_spIPicture->get_Height(&hmHeight)))
return CSize(0, 0);
CSize sz(hmWidth,hmHeight);
- if (pDC==NULL) {
+ if (pDC==nullptr) {
CWindowDC dc(nullptr);
dc.HIMETRICtoDP(&sz); // convert to pixels
} else {
// render to device context
bool Render(CDC* pDC, CRect rc=CRect(0,0,0,0),
- LPCRECT prcMFBounds=NULL) const;
+ LPCRECT prcMFBounds=nullptr) const;
- CSize GetImageSize(CDC* pDC=NULL) const;
+ CSize GetImageSize(CDC* pDC=nullptr) const;
operator IPicture*() {
return m_spIPicture;
const TCHAR PATHDELIM = '>';
CPreferencesDlg::CPreferencesDlg(COptionsMgr *regOptions, SyntaxColors *colors,
- UINT nMenuID, CWnd* pParent) // standard constructor
+ UINT nMenuID /*= 0*/, CWnd* pParent /*= nullptr*/) // standard constructor
: CTrDialog(IDD_PREFERENCES, pParent)
, m_pOptionsMgr(regOptions)
, m_pageGeneral(regOptions)
{
// Construction
public:
- //CPreferencesDlg(UINT nMenuID = 0, CWnd* pParent = NULL); // standard constructor
+ //CPreferencesDlg(UINT nMenuID = 0, CWnd* pParent = nullptr); // standard constructor
CPreferencesDlg(COptionsMgr *optionsMgr, SyntaxColors *colors,
- UINT nMenuID = 0, CWnd* pParent = NULL); // standard constructor
+ UINT nMenuID = 0, CWnd* pParent = nullptr); // standard constructor
virtual ~CPreferencesDlg();
void SetSyntaxColors(SyntaxColors *pColors);
return SetActivePage(FindPage(pPage));
}
-bool CPropertyPageHost::AddPage(CPropertyPage* pPage, LPCTSTR szTitle, DWORD dwItemData)
+bool CPropertyPageHost::AddPage(CPropertyPage* pPage, LPCTSTR szTitle /*= nullptr*/, DWORD dwItemData /*= 0*/)
{
if (!pPage || !pPage->IsKindOf(RUNTIME_CLASS(CPropertyPage)))
return FALSE;
struct PAGEITEM
{
- PAGEITEM(CPropertyPage* _pPage = NULL, LPCTSTR szTitle = NULL, DWORD dwData = 0) :
+ PAGEITEM(CPropertyPage* _pPage = nullptr, LPCTSTR szTitle = nullptr, DWORD dwData = 0) :
pPage(_pPage), sTitle(szTitle), dwItemData(dwData) {}
CPropertyPage* pPage;
int GetActiveIndex();
CPropertyPage* GetActivePage();
- bool AddPage(CPropertyPage* pPage, LPCTSTR szTitle = NULL, DWORD dwItemData = 0);
+ bool AddPage(CPropertyPage* pPage, LPCTSTR szTitle = nullptr, DWORD dwItemData = 0);
bool SetActivePage(int nIndex, bool bAndFocus = true);
bool SetActivePage(CPropertyPage* pPage, bool bAndFocus = true);
int GetPageCount() { return (int) m_aPages.GetSize(); }
* Menu is created in constructor and does not normally change when requesting context menu via RequeryShellContextMenu()
* It may though change if destroyed by someone. In this case it should be recreated in RequeryShellContextMenu()
*
- * @retval NULL If handle is destroyed by parent menu, but not yet recreated by RequeryShellContextMenu()
+ * @retval nullptr If handle is destroyed by parent menu, but not yet recreated by RequeryShellContextMenu()
*/
HMENU GetHMENU() const;
* @param [in] parentWindow Window getting notifications.
*/
void ShellFileOperations::SetOperation(UINT operation, FILEOP_FLAGS flags,
- HWND parentWindow /*= NULL*/)
+ HWND parentWindow /*= nullptr*/)
{
m_function = operation;
m_flags = flags;
void AddSourceAndDestination(const String &source, const String &destination);
void AddSource(const String &source);
void SetDestination(const String &destination);
- void SetOperation(UINT operation, FILEOP_FLAGS flags, HWND parentWindow = NULL);
+ void SetOperation(UINT operation, FILEOP_FLAGS flags, HWND parentWindow = nullptr);
bool Run();
bool IsCanceled() const;
void Reset();
, m_bVersionOnly(false)
, m_bDllVersion(bDllVersion)
{
- if (szFileToVersion != NULL)
+ if (szFileToVersion != nullptr)
m_strFileName = szFileToVersion;
GetVersionInfo();
}
* @param [in] szLanguage Language for version.
* @param [in] szCodePage Codepage for version.
*/
-CVersionInfo::CVersionInfo(LPCTSTR szFileToVersion /* = NULL*/,
- LPCTSTR szLanguage /* = NULL*/,
- LPCTSTR szCodepage /* = NULL*/)
+CVersionInfo::CVersionInfo(LPCTSTR szFileToVersion /* = nullptr*/,
+ LPCTSTR szLanguage /* = nullptr*/,
+ LPCTSTR szCodepage /* = nullptr*/)
: m_wLanguage(0)
, m_bVersionOnly(false)
, m_bDllVersion(false)
{
- if (szFileToVersion != NULL)
+ if (szFileToVersion != nullptr)
m_strFileName = szFileToVersion;
- if (szLanguage != NULL)
+ if (szLanguage != nullptr)
m_strLanguage = szLanguage;
- if (szCodepage != NULL)
+ if (szCodepage != nullptr)
m_strCodepage = szCodepage;
GetVersionInfo();
}
explicit CVersionInfo(WORD wLanguage);
CVersionInfo(LPCTSTR szFileToVersion,
bool bDllVersion);
- CVersionInfo(LPCTSTR szFileToVersion = NULL,
- LPCTSTR szLanguage = NULL,
- LPCTSTR szCodepage = NULL);
+ CVersionInfo(LPCTSTR szFileToVersion = nullptr,
+ LPCTSTR szLanguage = nullptr,
+ LPCTSTR szCodepage = nullptr);
explicit CVersionInfo(HINSTANCE hModule);
String GetFileVersion() const;
String GetCompanyName() const;
// All we need to do is replace the DC with an illegal value,
// this keeps us from accidently deleting the handles associated with
// the CDC that was passed to the constructor.
- m_hDC = m_hAttribDC = NULL;
+ m_hDC = m_hAttribDC = nullptr;
}
}
newFilename = GetDataFileUnicode();
else
newFilename = GetDataFileAnsi();
- if (newFilename == NULL)
+ if (newFilename == nullptr)
{
GetLastValidFile(filename);
return false;
IMPLEMENT_DYNAMIC(CompareStatisticsDlg, CTrDialog)
-CompareStatisticsDlg::CompareStatisticsDlg(const CompareStats* pStats, CWnd* pParent /*=NULL*/) :
+CompareStatisticsDlg::CompareStatisticsDlg(const CompareStats* pStats, CWnd* pParent /*= nullptr*/) :
m_pCompareStats(pStats),
CTrDialog(pStats->GetCompareDirs() < 3 ? IDD_COMPARE_STATISTICS : IDD_COMPARE_STATISTICS3, pParent)
{
DECLARE_DYNAMIC(CompareStatisticsDlg)
public:
- CompareStatisticsDlg(const CompareStats * pStats, CWnd* pParent = NULL); // standard constructor
+ CompareStatisticsDlg(const CompareStats * pStats, CWnd* pParent = nullptr); // standard constructor
// Dialog Data
//{{AFX_DATA(CompareStatisticsDlg)
// ConfirmFolderCopyDlg dialog
IMPLEMENT_DYNAMIC(ConfirmFolderCopyDlg, CTrDialog)
-ConfirmFolderCopyDlg::ConfirmFolderCopyDlg(CWnd* pParent /*=NULL*/)
+ConfirmFolderCopyDlg::ConfirmFolderCopyDlg(CWnd* pParent /*= nullptr*/)
: CTrDialog(ConfirmFolderCopyDlg::IDD, pParent)
{
}
DECLARE_DYNAMIC(ConfirmFolderCopyDlg)
public:
- explicit ConfirmFolderCopyDlg(CWnd* pParent = NULL); // standard constructor
+ explicit ConfirmFolderCopyDlg(CWnd* pParent = nullptr); // standard constructor
virtual ~ConfirmFolderCopyDlg();
// Dialog Data
}
}
-void DiffList::AppendDiffList(const DiffList& list, int offset[], int doffset)
+void DiffList::AppendDiffList(const DiffList& list, int offset[] /*= nullptr*/, int doffset /*= 0*/)
{
for (std::vector<DiffRangeInfo>::const_iterator it = list.m_diffs.begin(); it != list.m_diffs.end(); ++it)
{
DIFFRANGE dr = *it;
for (int file = 0; file < 3; ++file)
{
- if (offset)
+ if (offset != nullptr)
{
dr.begin[file] += offset[file];
dr.end[file] += offset[file];
}
- if (doffset)
+ if (doffset != 0)
dr.blank[file] += doffset;
}
- if (doffset)
+ if (doffset != 0)
{
dr.dbegin += doffset;
dr.dend += doffset;
std::vector<DiffRangeInfo>& GetDiffRangeInfoVector() { return m_diffs; }
- void AppendDiffList(const DiffList& list, int offset[] = NULL, int doffset = 0);
+ void AppendDiffList(const DiffList& list, int offset[] = nullptr, int doffset = 0);
private:
std::vector<DiffRangeInfo> m_diffs; /**< Difference list. */
AddUndoRecord(bool bInsert, const CPoint & ptStartPos,
const CPoint & ptEndPos, LPCTSTR pszText, size_t cchText,
int nActionType /*= CE_ACTION_UNKNOWN*/,
- CDWordArray *paSavedRevisionNumbers)
+ CDWordArray *paSavedRevisionNumbers /*= nullptr*/)
{
CGhostTextBuffer::AddUndoRecord(bInsert, ptStartPos, ptEndPos, pszText,
cchText, nActionType, paSavedRevisionNumbers);
virtual void AddUndoRecord (bool bInsert, const CPoint & ptStartPos,
const CPoint & ptEndPos, LPCTSTR pszText, size_t cchText,
int nActionType = CE_ACTION_UNKNOWN,
- CDWordArray *paSavedRevisionNumbers = NULL) override;
+ CDWordArray *paSavedRevisionNumbers = nullptr) override;
bool curUndoGroup();
void ReplaceFullLines(CDiffTextBuffer& dbuf, CDiffTextBuffer& sbuf, CCrystalTextView * pSource, int nLineBegin, int nLineEnd, int nAction =CE_ACTION_UNKNOWN);
*/
BOOL CDiffViewBar::Create(
CWnd* pParentWnd,
- LPCTSTR lpszWindowName,
- DWORD dwStyle,
- UINT nID)
+ LPCTSTR lpszWindowName /*= nullptr*/,
+ DWORD dwStyle /*= WS_CHILD | WS_VISIBLE | CBRS_TOP*/,
+ UINT nID /*= AFX_IDW_PANE_FIRST*/)
{
return TViewBarBase::Create(
lpszWindowName,
virtual ~CDiffViewBar();
virtual BOOL Create(
CWnd* pParentWnd, // mandatory
- LPCTSTR lpszWindowName = NULL,
+ LPCTSTR lpszWindowName = nullptr,
DWORD dwStyle = WS_CHILD | WS_VISIBLE | CBRS_TOP,
UINT nID = AFX_IDW_PANE_FIRST);
typedef bool (DirActions::*method_type2)(const DIFFITEM& di) const;
typedef FileActionScript *(DirActions::*method_type)(FileActionScript *, const std::pair<int, const DIFFITEM *>& it) const;
- DirActions(const CDiffContext& ctxt, const bool RO[], method_type func = NULL, method_type2 func2 = NULL) :
+ DirActions(const CDiffContext& ctxt, const bool RO[], method_type func = nullptr, method_type2 func2 = nullptr) :
m_ctxt(ctxt), m_RO(RO), m_cur_method(func), m_cur_method2(func2) {}
template <SIDE_TYPE src, SIDE_TYPE dst>
/**
* @brief Constructor.
*/
-DirCmpReportDlg::DirCmpReportDlg(CWnd* pParent /*=NULL*/)
+DirCmpReportDlg::DirCmpReportDlg(CWnd* pParent /*= nullptr*/)
: CTrDialog(DirCmpReportDlg::IDD, pParent)
, m_bCopyToClipboard(false)
, m_bIncludeFileCmpReport(false)
DECLARE_DYNAMIC(DirCmpReportDlg)
public:
- explicit DirCmpReportDlg(CWnd* pParent = NULL); // standard constructor
+ explicit DirCmpReportDlg(CWnd* pParent = nullptr); // standard constructor
// Dialog Data
enum { IDD = IDD_DIRCMP_REPORT };
* @brief Default dialog constructor.
* @param [in] pParent Dialog's parent component (window).
*/
-CDirColsDlg::CDirColsDlg(CWnd* pParent /*=NULL*/)
+CDirColsDlg::CDirColsDlg(CWnd* pParent /*= nullptr*/)
: CTrDialog(CDirColsDlg::IDD, pParent)
, m_bReset(false)
{
// Construction
public:
- explicit CDirColsDlg(CWnd* pParent = NULL); // standard constructor
+ explicit CDirColsDlg(CWnd* pParent = nullptr); // standard constructor
void AddColumn(const String & name, const String & desc, int log, int phy=-1)
{ column c(name, desc, log, phy); m_cols.push_back(c); }
void AddDefColumn(const String & name, int log, int phy=-1)
void SetReportFile(const String& sReportFile) { m_sReportFile = sReportFile; }
bool GetGeneratingReport() const { return m_bGeneratingReport; }
void SetGeneratingReport(bool bGeneratingReport) { m_bGeneratingReport = bGeneratingReport; }
- bool HasDirView() const { return m_pDirView != NULL; }
+ bool HasDirView() const { return m_pDirView != nullptr; }
void RefreshOptions();
void CompareReady();
void UpdateChangedItem(PathContext & paths,
void SetDescriptions(const String strDesc[]);
void ApplyDisplayRoot(int nIndex, String &);
- bool HasDiffs() const { return m_pCtxt != NULL; }
+ bool HasDiffs() const { return m_pCtxt != nullptr; }
const CDiffContext & GetDiffContext() const { return *m_pCtxt; }
CDiffContext& GetDiffContext() { return *m_pCtxt.get(); }
void SetMarkedRescan() {m_bMarkedRescan = true; }
/**
* @brief User is starting to drag a column header
*/
-BOOL CDirView::OnHeaderBeginDrag(LPNMHEADER hdr, LRESULT* pResult)
+bool CDirView::OnHeaderBeginDrag(LPNMHEADER hdr, LRESULT* pResult)
{
// save column widths before user reorders them
// so we can reload them on the end drag
String secname = GetDocument()->m_nDirs < 3 ? _T("DirView") : _T("DirView3");
theApp.WriteProfileString(secname.c_str(), _T("ColumnWidths"),
m_pColItems->SaveColumnWidths(std::bind(&CListCtrl::GetColumnWidth, m_pList, _1)).c_str());
- return TRUE;
+ return true;
}
/**
* @brief User just finished dragging a column header
*/
-BOOL CDirView::OnHeaderEndDrag(LPNMHEADER hdr, LRESULT* pResult)
+bool CDirView::OnHeaderEndDrag(LPNMHEADER hdr, LRESULT* pResult)
{
int src = hdr->iItem;
int dest = hdr->pitem->iOrder;
- bool allowDrop = TRUE;
- *pResult = !allowDrop;
+ bool allowDrop = true;
+ *pResult = allowDrop ? FALSE : TRUE;
if (allowDrop && src != dest && dest != -1)
{
m_pColItems->MoveColumn(src, dest);
InitiateSort();
}
- return TRUE;
+ return true;
}
/**
afx_msg void OnBnClickedComparisonContinue();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
- BOOL OnHeaderBeginDrag(LPNMHEADER hdr, LRESULT* pResult);
- BOOL OnHeaderEndDrag(LPNMHEADER hdr, LRESULT* pResult);
+ bool OnHeaderBeginDrag(LPNMHEADER hdr, LRESULT* pResult);
+ bool OnHeaderEndDrag(LPNMHEADER hdr, LRESULT* pResult);
private:
void OpenSelection(SELECTIONTYPE selectionType = SELECTIONTYPE_NORMAL, PackingInfo * infoUnpacker = nullptr);
* @param [out] pnerr Error code if error happened.
* @return Full path for temporary file or empty string if error happened.
*/
-String GetTemporaryFileName(const String& lpPathName, const String& lpPrefixString, int * pnerr)
+String GetTemporaryFileName(const String& lpPathName, const String& lpPrefixString, int * pnerr /*= nullptr*/)
{
TCHAR buffer[MAX_PATH] = {0};
if (lpPathName.length() > MAX_PATH-14)
void SetTemporaryPath(const String& path);
String GetTemporaryPath();
String GetTemporaryFileName(const String& lpPathName, const String& lpPrefixString,
- int * pnerr = NULL);
+ int * pnerr = nullptr);
String GetTempChildPath();
void SetProgPath(const String& path);
String GetProgPath();
// don't localize this as we do not localize the known exceptions
return _T("Unknown structured exception");
}
- virtual bool GetErrorMessage( TCHAR *lpszError, unsigned nMaxError, unsigned *pnHelpContext = NULL )
+ virtual bool GetErrorMessage( TCHAR *lpszError, unsigned nMaxError, unsigned *pnHelpContext = nullptr )
{
StringCchPrintf(lpszError, nMaxError, _T("Exception %s (0x%.8x)"), getSeMessage(), static_cast<unsigned>(getSeNumber()));
return true;
}
#else
- virtual bool GetErrorMessage( TCHAR *lpszError, unsigned nMaxError, unsigned *pnHelpContext = NULL )
+ virtual bool GetErrorMessage( TCHAR *lpszError, unsigned nMaxError, unsigned *pnHelpContext = nullptr )
{
return true;
}
* file or folder to open or file to save. The last parameter @p is_open selects
* between open or save modes. Biggest difference is that in save-mode Windows
* asks if user wants to override existing file.
- * @param [in] parent Handle to parent window. Can be a NULL, but then
+ * @param [in] parent Handle to parent window. Can be `nullptr`, but then
* CMainFrame is used which can cause modality problems.
* @param [out] path Selected path is returned in this string
* @param [in] initialPath Initial path (and file) shown when dialog is opened
* @param [in] filterid 0 or STRING ID for filter string
* - 0 means "All files (*.*)". Note the string formatting!
* @param [in] is_open Selects Open/Save -dialog (mode).
- * @note Be careful when setting @p parent to NULL as there are potential
+ * @note Be careful when setting @p parent to `nullptr` as there are potential
* 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*/,
- LPCTSTR initialPath /*=NULL*/, const String& stitle /*=_T("")*/,
- const String& sfilter /*=_T("")*/, LPCTSTR defaultExtension /*=NULL*/)
+ LPCTSTR initialPath /*= nullptr*/, const String& stitle /*=_T("")*/,
+ const String& sfilter /*=_T("")*/, LPCTSTR defaultExtension /*= nullptr*/)
{
path.clear(); // Clear output param
OPENFILENAME_NT4 ofn = { sizeof OPENFILENAME_NT4 };
ofn.hwndOwner = parent;
ofn.lpstrFilter = filtersStr;
- ofn.lpstrCustomFilter = NULL;
+ ofn.lpstrCustomFilter = nullptr;
ofn.nFilterIndex = 1;
ofn.lpstrFile = sSelectedFile;
ofn.nMaxFile = MAX_PATH_FULL;
ofn.lpstrInitialDir = initialPath;
ofn.lpstrTitle = title.c_str();
- ofn.lpstrFileTitle = NULL;
+ ofn.lpstrFileTitle = nullptr;
if (defaultExtension)
ofn.lpstrDefExt = defaultExtension;
ofn.Flags = OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST | OFN_NOCHANGEDIR;
* @param [in] hwndOwner Handle to owner window or NULL
* @return `true` if valid folder selected (not cancelled)
*/
-bool SelectFolder(String& path, LPCTSTR root_path /*=NULL*/,
+bool SelectFolder(String& path, LPCTSTR root_path /*= nullptr*/,
const String& stitle /*=_T("")*/,
- HWND hwndOwner /*=NULL*/)
+ HWND hwndOwner /*= nullptr*/)
{
BROWSEINFO bi;
LPITEMIDLIST pidl;
TCHAR szPath[MAX_PATH_FULL] = {0};
bool bRet = false;
String title = stitle;
- if (root_path == NULL)
+ if (root_path == nullptr)
LastSelectedFolder.clear();
else
LastSelectedFolder = root_path;
bi.hwndOwner = hwndOwner;
- bi.pidlRoot = NULL; // Start from desktop folder
+ bi.pidlRoot = nullptr; // Start from desktop folder
bi.pszDisplayName = szPath;
bi.lpszTitle = title.c_str();
bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_USENEWUI | BIF_VALIDATE;
bi.lParam = (LPARAM)root_path;
pidl = SHBrowseForFolder(&bi);
- if (pidl)
+ if (pidl != nullptr)
{
if (SHGetPathFromIDList(pidl, szPath))
{
* - If existing filename is selected return it
* - If filename in (CFileDialog) editbox and current folder doesn't form
* a valid path to file, return current folder.
- * @param [in] parent Handle to parent window. Can be a NULL, but then
+ * @param [in] parent Handle to parent window. Can be `nullptr`, but then
* 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.
*/
-bool SelectFileOrFolder(HWND parent, String& path, LPCTSTR initialPath /*=NULL*/)
+bool SelectFileOrFolder(HWND parent, String& path, LPCTSTR initialPath /*= nullptr*/)
{
String title = _("Open");
TCHAR sSelectedFile[MAX_PATH_FULL];
// check if specified path is a file
- if (initialPath && initialPath[0])
+ if (initialPath!=nullptr && initialPath[0] != '\0')
{
// If initial path info includes a file
// we put the bare filename into sSelectedFile
#include "UnicodeString.h"
bool SelectFile(HWND parent, String& path, bool is_open = true,
- LPCTSTR initialPath = NULL, const String& stitle = _T(""),
- const String& sfilter = _T(""), LPCTSTR defaultExtension = NULL);
+ LPCTSTR initialPath = nullptr, const String& stitle = _T(""),
+ const String& sfilter = _T(""), LPCTSTR defaultExtension = nullptr);
-bool SelectFolder(String& path, LPCTSTR root_path = NULL,
+bool SelectFolder(String& path, LPCTSTR root_path = nullptr,
const String& title = _T(""),
- HWND hwndOwner = NULL);
+ HWND hwndOwner = nullptr);
-bool SelectFileOrFolder(HWND parent, String& path, LPCTSTR root_path = NULL);
+bool SelectFileOrFolder(HWND parent, String& path, LPCTSTR root_path = nullptr);
bool bHandled = false;
PluginInfo * plugin = CAllThreadsScripts::GetActiveSet()->GetPluginByName(L"FILE_PACK_UNPACK", handler.pluginName);
- if (plugin == NULL)
+ if (plugin == nullptr)
plugin = CAllThreadsScripts::GetActiveSet()->GetPluginByName(L"FILE_FOLDER_PACK_UNPACK", handler.pluginName);
- if (plugin == NULL)
+ if (plugin == nullptr)
plugin = CAllThreadsScripts::GetActiveSet()->GetPluginByName(L"BUFFER_PACK_UNPACK", handler.pluginName);
LPDISPATCH piScript = plugin->m_lpDispatch;
if (handler.bWithFile)
bool Unpacking(String & filepath, const PackingInfo * handler, int * handlerSubcode)
{
// no handler : return true
- if (!handler || handler->pluginName.empty())
+ if (handler == nullptr || handler->pluginName.empty())
return true;
storageForPlugins bufferData;
bool bHandled = false;
PluginInfo * plugin = CAllThreadsScripts::GetActiveSet()->GetPluginByName(L"FILE_PACK_UNPACK", handler->pluginName);
- if (plugin == NULL)
+ if (plugin == nullptr)
plugin = CAllThreadsScripts::GetActiveSet()->GetPluginByName(L"FILE_FOLDER_PACK_UNPACK", handler->pluginName);
- if (plugin == NULL)
+ if (plugin == nullptr)
plugin = CAllThreadsScripts::GetActiveSet()->GetPluginByName(L"BUFFER_PACK_UNPACK", handler->pluginName);
- if (plugin == NULL)
+ if (plugin == nullptr)
return false;
LPDISPATCH piScript = plugin->m_lpDispatch;
bool bHandled = false;
PluginInfo * plugin = CAllThreadsScripts::GetActiveSet()->GetAutomaticPluginByFilter(L"FILE_PACK_UNPACK", filteredText);
- if (!plugin)
+ if (plugin == nullptr)
plugin = CAllThreadsScripts::GetActiveSet()->GetAutomaticPluginByFilter(L"FILE_FOLDER_PACK_UNPACK", filteredText);
- if (plugin)
+ if (plugin != nullptr)
{
handler->pluginName = plugin->m_name;
handler->bWithFile = true;
if (!bHandled)
{
plugin = CAllThreadsScripts::GetActiveSet()->GetAutomaticPluginByFilter(L"BUFFER_PACK_UNPACK", filteredText);
- if (plugin)
+ if (plugin != nullptr)
{
handler->pluginName = plugin->m_name;
handler->bWithFile = false;
bool bHandled = false;
PluginInfo * plugin = CAllThreadsScripts::GetActiveSet()->GetPluginByName(L"FILE_PREDIFF", handler.pluginName);
- if (!plugin)
+ if (plugin == nullptr)
{
plugin = CAllThreadsScripts::GetActiveSet()->GetPluginByName(L"BUFFER_PREDIFF", handler.pluginName);
- if (!plugin)
+ if (plugin == nullptr)
return false;
}
LPDISPATCH piScript = plugin->m_lpDispatch;
bool bHandled = false;
PluginInfo * plugin = CAllThreadsScripts::GetActiveSet()->GetAutomaticPluginByFilter(L"FILE_PREDIFF", filteredText);
- if (plugin)
+ if (plugin != nullptr)
{
handler->pluginName = plugin->m_name;
handler->bWithFile = true;
if (!bHandled)
{
plugin = CAllThreadsScripts::GetActiveSet()->GetAutomaticPluginByFilter(L"BUFFER_PREDIFF", filteredText);
- if (plugin)
+ if (plugin != nullptr)
{
handler->pluginName = plugin->m_name;
handler->bWithFile = false;
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` if the plugins exchange data through a file, `false` is the data is passed as parameter (BSTR/ARRAY)
bool bWithFile;
};
AddUndoRecord(bool bInsert, const CPoint & ptStartPos,
const CPoint & ptEndPos, LPCTSTR pszText, size_t cchText,
int nActionType /*= CE_ACTION_UNKNOWN*/,
- CDWordArray *paSavedRevisionNumbers)
+ CDWordArray *paSavedRevisionNumbers /*= nullptr*/)
{
CPoint real_ptStartPos(ptStartPos.x, ComputeRealLine(ptStartPos.y));
CPoint real_ptEndPos(ptEndPos.x, real_ptStartPos.y + CountEol(pszText, cchText));
#endif
virtual void AddUndoRecord (bool bInsert, const CPoint & ptStartPos, const CPoint & ptEndPos,
- LPCTSTR pszText, size_t cchText, int nActionType = CE_ACTION_UNKNOWN, CDWordArray *paSavedRevisionNumbers = NULL) override;
+ LPCTSTR pszText, size_t cchText, int nActionType = CE_ACTION_UNKNOWN, CDWordArray *paSavedRevisionNumbers = nullptr) override;
virtual UndoRecord GetUndoRecord(int nUndoPos) const override;
virtual bool UndoInsert(CCrystalTextView * pSource, CPoint & ptCursorPos,
const CPoint apparent_ptStartPos, CPoint const apparent_ptEndPos, const UndoRecord & ur) override;
}
void CGhostTextView::
-ReAttachToBuffer (CCrystalTextBuffer * pBuf /*= NULL*/ )
+ReAttachToBuffer (CCrystalTextBuffer * pBuf /*= nullptr*/ )
{
- if (pBuf == NULL)
+ if (pBuf == nullptr)
{
pBuf = LocateTextBuffer ();
// ...
}
void CGhostTextView::
-AttachToBuffer (CCrystalTextBuffer * pBuf /*= NULL*/ )
+AttachToBuffer (CCrystalTextBuffer * pBuf /*= nullptr*/ )
{
- if (pBuf == NULL)
+ if (pBuf == nullptr)
{
pBuf = LocateTextBuffer ();
// ...
void CGhostTextView::
DetachFromBuffer ()
{
- if (m_pGhostTextBuffer != NULL)
- m_pGhostTextBuffer = NULL;
+ if (m_pGhostTextBuffer != nullptr)
+ m_pGhostTextBuffer = nullptr;
CCrystalEditViewEx::DetachFromBuffer();
}
// m_ptDropPos : only used inside one function which does not change the buffer
public:
- virtual void ReAttachToBuffer (CCrystalTextBuffer * pBuf = NULL);
- virtual void AttachToBuffer (CCrystalTextBuffer * pBuf = NULL);
+ virtual void ReAttachToBuffer (CCrystalTextBuffer * pBuf = nullptr);
+ virtual void AttachToBuffer (CCrystalTextBuffer * pBuf = nullptr);
virtual void DetachFromBuffer ();
/** real cursor function to preserve cursor during Rescan */
bmpinfo.bmiHeader.biPlanes = 1;\r
bmpinfo.bmiHeader.biBitCount = 32;\r
bmpinfo.bmiHeader.biCompression = BI_RGB;\r
- HBITMAP hbmpImage = CreateDIBSection(NULL, &bmpinfo, DIB_RGB_COLORS, &pBits, NULL, NULL);\r
+ HBITMAP hbmpImage = CreateDIBSection(nullptr, &bmpinfo, DIB_RGB_COLORS, &pBits, nullptr, 0);\r
if (hbmpImage)\r
{\r
HBITMAP hbmpOld = (HBITMAP)SelectObject(hdcMem, hbmpImage);\r
CImage image;\r
image.Attach(hbmpImage);\r
image.SetHasAlphaChannel(true);\r
- IStream *pStream = NULL;\r
- if (SUCCEEDED(CreateStreamOnHGlobal(NULL, TRUE, &pStream)))\r
+ IStream *pStream = nullptr;\r
+ if (SUCCEEDED(CreateStreamOnHGlobal(nullptr, TRUE, &pStream)))\r
{\r
image.Save(pStream, Gdiplus::ImageFormatPNG);\r
STATSTG stat;\r
{\r
LARGE_INTEGER li = { 0 };\r
ret.resize(stat.cbSize.LowPart, 0);\r
- pStream->Seek(li, STREAM_SEEK_SET, NULL);\r
- pStream->Read(&ret[0], stat.cbSize.LowPart, NULL);\r
+ pStream->Seek(li, STREAM_SEEK_SET, nullptr);\r
+ pStream->Read(&ret[0], stat.cbSize.LowPart, nullptr);\r
}\r
pStream->Release();\r
}\r