Revision: 5514
http://winmerge.svn.sourceforge.net/winmerge/?rev=5514&view=rev
Author: kimmov
Date: 2008-06-24 01:47:25 -0700 (Tue, 24 Jun 2008)
Log Message:
-----------
Use CRLFSTYLE enum as a EOL style type instead of int.
Modified Paths:
--------------
trunk/Src/DiffTextBuffer.cpp
trunk/Src/DiffTextBuffer.h
trunk/Src/GhostTextBuffer.cpp
trunk/Src/GhostTextBuffer.h
trunk/Src/GhostTextView.cpp
trunk/Src/GhostTextView.h
trunk/Src/MergeDoc.cpp
trunk/Src/MergeEditView.cpp
trunk/Src/editlib/ccrystaltextbuffer.cpp
trunk/Src/editlib/ccrystaltextbuffer.h
trunk/Src/editlib/ccrystaltextview.cpp
trunk/Src/editlib/ccrystaltextview.h
Modified: trunk/Src/DiffTextBuffer.cpp
===================================================================
--- trunk/Src/DiffTextBuffer.cpp 2008-06-24 07:35:58 UTC (rev 5513)
+++ trunk/Src/DiffTextBuffer.cpp 2008-06-24 08:47:25 UTC (rev 5514)
@@ -27,7 +27,7 @@
const COleDateTime & start);
static void EscapeControlChars(CString &s);
static LPCTSTR GetEol(const CString &str);
-static int GetTextFileStyle(const UniMemFile::txtstats & stats);
+static CRLFSTYLE GetTextFileStyle(const UniMemFile::txtstats & stats);
/**
* @brief Check if file has only one EOL type.
@@ -131,7 +131,7 @@
* @param [in] stats File's text stats.
* @return EOL type.
*/
-static int GetTextFileStyle(const UniMemFile::txtstats & stats)
+static CRLFSTYLE GetTextFileStyle(const UniMemFile::txtstats & stats)
{
if (stats.ncrlfs >= stats.nlfs)
{
@@ -330,7 +330,7 @@
*/
int CDiffTextBuffer::LoadFromFile(LPCTSTR pszFileNameInit,
PackingInfo * infoUnpacker, LPCTSTR sToFindUnpacker, BOOL & readOnly,
- int nCrlfStyle, const FileTextEncoding & encoding, CString &sError)
+ CRLFSTYLE nCrlfStyle, const FileTextEncoding & encoding, CString &sError)
{
ASSERT(!m_bInit);
ASSERT(m_aLines.GetSize() == 0);
@@ -541,11 +541,9 @@
*/
int CDiffTextBuffer::SaveToFile (LPCTSTR pszFileName,
BOOL bTempFile, CString & sError, PackingInfo * infoUnpacker /*= NULL*/,
- int nCrlfStyle /*= CRLF_STYLE_AUTOMATIC*/,
+ CRLFSTYLE nCrlfStyle /*= CRLF_STYLE_AUTOMATIC*/,
BOOL bClearModifiedFlag /*= TRUE*/ )
{
- ASSERT (nCrlfStyle == CRLF_STYLE_AUTOMATIC || nCrlfStyle == CRLF_STYLE_DOS ||
- nCrlfStyle == CRLF_STYLE_UNIX || nCrlfStyle == CRLF_STYLE_MAC);
ASSERT (m_bInit);
if (!pszFileName || _tcslen(pszFileName) == 0)
Modified: trunk/Src/DiffTextBuffer.h
===================================================================
--- trunk/Src/DiffTextBuffer.h 2008-06-24 07:35:58 UTC (rev 5513)
+++ trunk/Src/DiffTextBuffer.h 2008-06-24 08:47:25 UTC (rev 5514)
@@ -51,10 +51,10 @@
void ReplaceFullLine(CCrystalTextView * pSource, int nLine, const CString& strText, int nAction =CE_ACTION_UNKNOWN);
int LoadFromFile(LPCTSTR pszFileName, PackingInfo * infoUnpacker,
- LPCTSTR filteredFilenames, BOOL & readOnly, int nCrlfStyle,
+ LPCTSTR filteredFilenames, BOOL & readOnly, CRLFSTYLE nCrlfStyle,
const FileTextEncoding & encoding, CString &sError);
int SaveToFile (LPCTSTR pszFileName, BOOL bTempFile, CString & sError,
- PackingInfo * infoUnpacker = NULL, int nCrlfStyle = CRLF_STYLE_AUTOMATIC,
+ PackingInfo * infoUnpacker = NULL, CRLFSTYLE nCrlfStyle = CRLF_STYLE_AUTOMATIC,
BOOL bClearModifiedFlag = TRUE );
int getUnicoding() const { return m_encoding.m_unicoding; }
void setUnicoding(int value) { m_encoding.m_unicoding = value; }
Modified: trunk/Src/GhostTextBuffer.cpp
===================================================================
--- trunk/Src/GhostTextBuffer.cpp 2008-06-24 07:35:58 UTC (rev 5513)
+++ trunk/Src/GhostTextBuffer.cpp 2008-06-24 08:47:25 UTC (rev 5514)
@@ -58,7 +58,7 @@
}
BOOL CGhostTextBuffer::
-InitNew (int nCrlfStyle /*= CRLF_STYLE_DOS*/ )
+InitNew (CRLFSTYLE nCrlfStyle /*= CRLF_STYLE_DOS*/ )
{
m_bUndoBeginGroup = FALSE;
return CCrystalTextBuffer::InitNew(nCrlfStyle);
@@ -157,7 +157,7 @@
*/
void CGhostTextBuffer::GetTextWithoutEmptys(int nStartLine, int nStartChar,
int nEndLine, int nEndChar,
- CString &text, int nCrlfStyle /* CRLF_STYLE_AUTOMATIC */)
+ CString &text, CRLFSTYLE nCrlfStyle /* CRLF_STYLE_AUTOMATIC */)
{
int lines = (int) m_aLines.GetSize();
ASSERT(nStartLine >= 0 && nStartLine < lines);
Modified: trunk/Src/GhostTextBuffer.h
===================================================================
--- trunk/Src/GhostTextBuffer.h 2008-06-24 07:35:58 UTC (rev 5513)
+++ trunk/Src/GhostTextBuffer.h 2008-06-24 08:47:25 UTC (rev 5514)
@@ -229,14 +229,16 @@
public :
// Construction/destruction code
CGhostTextBuffer ();
- virtual BOOL InitNew (int nCrlfStyle = CRLF_STYLE_DOS);
+ virtual BOOL InitNew (CRLFSTYLE nCrlfStyle = CRLF_STYLE_DOS);
/**
This should work in base code as ghost lines are real empty lines
but maybe it doesn't (if there is an assert to check there is an EOL,
or if it adds the default EOL)
*/
- virtual void GetTextWithoutEmptys (int nStartLine, int nStartChar, int nEndLine, int nEndChar, CString &text, int nCrlfStyle =CRLF_STYLE_AUTOMATIC );
+ virtual void GetTextWithoutEmptys (int nStartLine, int nStartChar,
+ int nEndLine, int nEndChar, CString &text,
+ CRLFSTYLE nCrlfStyle =CRLF_STYLE_AUTOMATIC);
// Text modification functions
Modified: trunk/Src/GhostTextView.cpp
===================================================================
--- trunk/Src/GhostTextView.cpp 2008-06-24 07:35:58 UTC (rev 5513)
+++ trunk/Src/GhostTextView.cpp 2008-06-24 08:47:25 UTC (rev 5514)
@@ -197,7 +197,9 @@
return m_pGhostTextBuffer->ComputeApparentLine(nRealLine);
}
-void CGhostTextView::GetTextWithoutEmptys (int nStartLine, int nStartChar, int nEndLine, int nEndChar, CString &text, int nCrlfStyle /*=CRLF_STYLE_AUTOMATIC*/ )
+void CGhostTextView::GetTextWithoutEmptys (int nStartLine, int nStartChar,
+ int nEndLine, int nEndChar, CString &text,
+ CRLFSTYLE nCrlfStyle /*=CRLF_STYLE_AUTOMATIC*/ )
{
if (m_pGhostTextBuffer != NULL)
m_pGhostTextBuffer->GetTextWithoutEmptys (nStartLine, nStartChar, nEndLine, nEndChar, text, nCrlfStyle);
Modified: trunk/Src/GhostTextView.h
===================================================================
--- trunk/Src/GhostTextView.h 2008-06-24 07:35:58 UTC (rev 5513)
+++ trunk/Src/GhostTextView.h 2008-06-24 08:47:25 UTC (rev 5514)
@@ -105,7 +105,9 @@
/** real cursor function to preserve cursor during Rescan */
void PushCursors ();
- virtual void GetTextWithoutEmptys (int nStartLine, int nStartChar, int nEndLine, int nEndChar, CString &text, int nCrlfStyle =CRLF_STYLE_AUTOMATIC );
+ virtual void GetTextWithoutEmptys (int nStartLine, int nStartChar,
+ int nEndLine, int nEndChar, CString &text,
+ CRLFSTYLE nCrlfStyle =CRLF_STYLE_AUTOMATIC);
/**
* @brief Override this drag-n-drop function to call GetTextWithoutEmptys
*/
Modified: trunk/Src/MergeDoc.cpp
===================================================================
--- trunk/Src/MergeDoc.cpp 2008-06-24 07:35:58 UTC (rev 5513)
+++ trunk/Src/MergeDoc.cpp 2008-06-24 08:47:25 UTC (rev 5514)
@@ -1970,7 +1970,7 @@
pBuf = m_ptBuf[nBuffer];
nBuffer == 0 ? m_filePaths.SetLeft(sFileName) : m_filePaths.SetRight(sFileName);
- int nCrlfStyle = CRLF_STYLE_AUTOMATIC;
+ CRLFSTYLE nCrlfStyle = CRLF_STYLE_AUTOMATIC;
CString sOpenError;
retVal = pBuf->LoadFromFile(sFileName, m_pInfoUnpacker,
m_strBothFilenames.c_str(), readOnly, nCrlfStyle, encoding, sOpenError);
Modified: trunk/Src/MergeEditView.cpp
===================================================================
--- trunk/Src/MergeEditView.cpp 2008-06-24 07:35:58 UTC (rev 5513)
+++ trunk/Src/MergeEditView.cpp 2008-06-24 08:47:25 UTC (rev 5514)
@@ -2093,7 +2093,7 @@
*/
void CMergeEditView::OnConvertEolTo(UINT nID )
{
- int nStyle = CRLF_STYLE_AUTOMATIC;;
+ CRLFSTYLE nStyle = CRLF_STYLE_AUTOMATIC;;
switch (nID)
{
case ID_EOL_TO_DOS:
Modified: trunk/Src/editlib/ccrystaltextbuffer.cpp
===================================================================
--- trunk/Src/editlib/ccrystaltextbuffer.cpp 2008-06-24 07:35:58 UTC (rev 5513)
+++ trunk/Src/editlib/ccrystaltextbuffer.cpp 2008-06-24 08:47:25 UTC (rev 5514)
@@ -183,7 +183,7 @@
m_bInit = FALSE;
m_bReadOnly = FALSE;
m_bModified = FALSE;
- m_nCRLFMode = 0;
+ m_nCRLFMode = CRLF_STYLE_DOS;
m_bCreateBackupFile = FALSE;
m_nUndoPosition = 0;
m_bInsertTabs = TRUE;
@@ -387,7 +387,7 @@
}
BOOL CCrystalTextBuffer::
-InitNew (int nCrlfStyle /*= CRLF_STYLE_DOS*/ )
+InitNew (CRLFSTYLE nCrlfStyle /*= CRLF_STYLE_DOS*/ )
{
ASSERT (!m_bInit);
ASSERT (m_aLines.GetSize () == 0);
@@ -718,7 +718,7 @@
}
#endif // #if 0 savetofile
-int CCrystalTextBuffer::
+CRLFSTYLE CCrystalTextBuffer::
GetCRLFMode ()
{
return m_nCRLFMode;
@@ -727,7 +727,7 @@
// Default EOL to use if editor has to manufacture one
// (this occurs with ghost lines)
void CCrystalTextBuffer::
-SetCRLFMode (int nCRLFMode)
+SetCRLFMode (CRLFSTYLE nCRLFMode)
{
if (nCRLFMode==CRLF_STYLE_AUTOMATIC)
nCRLFMode = CRLF_STYLE_DOS;
@@ -967,7 +967,7 @@
*/
void CCrystalTextBuffer::GetTextWithoutEmptys(int nStartLine, int nStartChar,
int nEndLine, int nEndChar,
- CString &text, int nCrlfStyle /* CRLF_STYLE_AUTOMATIC */)
+ CString &text, CRLFSTYLE nCrlfStyle /* CRLF_STYLE_AUTOMATIC */)
{
LPCTSTR sEol = GetStringEol (nCrlfStyle);
GetText(nStartLine, nStartChar, nEndLine, nEndChar, text, sEol);
@@ -1635,7 +1635,7 @@
ASSERT (m_aUndoBuf.GetSize () <= m_nUndoBufSize);
}
-LPCTSTR CCrystalTextBuffer::GetStringEol(int nCRLFMode)
+LPCTSTR CCrystalTextBuffer::GetStringEol(CRLFSTYLE nCRLFMode)
{
switch(nCRLFMode)
{
Modified: trunk/Src/editlib/ccrystaltextbuffer.h
===================================================================
--- trunk/Src/editlib/ccrystaltextbuffer.h 2008-06-24 07:35:58 UTC (rev 5513)
+++ trunk/Src/editlib/ccrystaltextbuffer.h 2008-06-24 08:47:25 UTC (rev 5514)
@@ -115,7 +115,7 @@
BOOL m_bInit;
BOOL m_bReadOnly;
BOOL m_bModified;
- int m_nCRLFMode;
+ CRLFSTYLE m_nCRLFMode;
BOOL m_IgnoreEol;
BOOL m_bCreateBackupFile;
int m_nUndoBufSize;
@@ -289,7 +289,7 @@
~CCrystalTextBuffer ();
// Basic functions
- BOOL InitNew (int nCrlfStyle = CRLF_STYLE_DOS);
+ BOOL InitNew (CRLFSTYLE nCrlfStyle = CRLF_STYLE_DOS);
// WinMerge has own routines for loading and saving
#ifdef CRYSTALEDIT_ENABLELOADER
@@ -324,15 +324,15 @@
int GetLineWithFlag (DWORD dwFlag);
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);
- virtual void GetTextWithoutEmptys (int nStartLine, int nStartChar, int nEndLine, int nEndChar, CString &text, int nCrlfStyle =CRLF_STYLE_AUTOMATIC );
+ virtual void GetTextWithoutEmptys (int nStartLine, int nStartChar, int nEndLine, int nEndChar, CString &text, CRLFSTYLE nCrlfStyle =CRLF_STYLE_AUTOMATIC );
// Attributes
- int GetCRLFMode ();
- void SetCRLFMode (int nCRLFMode);
+ CRLFSTYLE GetCRLFMode ();
+ void SetCRLFMode (CRLFSTYLE nCRLFMode);
/// Adjust all the lines in the buffer to the buffer default EOL Mode
virtual BOOL applyEOLMode();
LPCTSTR GetDefaultEol() const;
- static LPCTSTR GetStringEol(int nCRLFMode);
+ static LPCTSTR GetStringEol(CRLFSTYLE nCRLFMode);
BOOL GetReadOnly () const;
void SetReadOnly (BOOL bReadOnly = TRUE);
Modified: trunk/Src/editlib/ccrystaltextview.cpp
===================================================================
--- trunk/Src/editlib/ccrystaltextview.cpp 2008-06-24 07:35:58 UTC (rev 5513)
+++ trunk/Src/editlib/ccrystaltextview.cpp 2008-06-24 08:47:25 UTC (rev 5514)
@@ -2242,7 +2242,7 @@
}
void CCrystalTextView::
-SetCRLFMode (int nCRLFMode)
+SetCRLFMode (CRLFSTYLE nCRLFMode)
{
if (m_pTextBuffer)
{
@@ -4363,7 +4363,7 @@
if (m_pTextBuffer != NULL)
{
String eol;
- int crlfMode = m_pTextBuffer->GetCRLFMode ();
+ CRLFSTYLE crlfMode = m_pTextBuffer->GetCRLFMode ();
switch (crlfMode)
{
case CRLF_STYLE_DOS:
Modified: trunk/Src/editlib/ccrystaltextview.h
===================================================================
--- trunk/Src/editlib/ccrystaltextview.h 2008-06-24 07:35:58 UTC (rev 5513)
+++ trunk/Src/editlib/ccrystaltextview.h 2008-06-24 08:47:25 UTC (rev 5514)
@@ -668,7 +668,7 @@
// Attributes
public :
int GetCRLFMode ();
- void SetCRLFMode (int nCRLFMode);
+ void SetCRLFMode (enum CRLFSTYLE nCRLFMode);
BOOL GetViewTabs ();
void SetViewTabs (BOOL bViewTabs);
void SetViewEols (BOOL bViewEols, BOOL bDistinguishEols);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|