};
BOOL CCrystalTextBuffer::
-LoadFromFile (LPCTSTR pszFileName, int nCrlfStyle /*= CRLF_STYLE_AUTOMATIC*/ )
+LoadFromFile (LPCTSTR pszFileName, CRLFSTYLE nCrlfStyle /*= CRLF_STYLE_AUTOMATIC*/ )
{
ASSERT (!m_bInit);
ASSERT (m_aLines.size() == 0);
if (nCrlfStyle == CRLF_STYLE_AUTOMATIC)
{
// Try to determine current CRLF mode based on first line
- for (DWORD I = 0; I < dwCurSize; I++)
+ DWORD I;
+ for (I = 0; I < dwCurSize; I++)
{
if ((pcBuf[I] == _T('\x0d')) || (pcBuf[I] == _T('\x0a')))
break;
ASSERT (nCrlfStyle >= 0 && nCrlfStyle <= 2);
m_nCRLFMode = nCrlfStyle;
- m_aLines.setsize(4096);
+ m_aLines.reserve(4096);
DWORD dwBufPtr = 0;
while (dwBufPtr < dwCurSize)
nCurrentLength = 0;
if (m_nSourceEncoding >= 0)
iconvert (pcLineBuf, m_nSourceEncoding, 1, m_nSourceEncoding == 15);
- InsertLine (pcLineBuf);
+ InsertLine (pcLineBuf, lstrlen(pcLineBuf));
}
}
pcLineBuf[nCurrentLength] = 0;
- InsertLine (pcLineBuf);
+ InsertLine (pcLineBuf, nCurrentLength);
ASSERT (m_aLines.size() > 0); // At least one empty line must present
m_bReadOnly = (dwFileAttributes & FILE_ATTRIBUTE_READONLY) != 0;
m_bModified = FALSE;
m_bUndoGroup = m_bUndoBeginGroup = FALSE;
- m_nUndoBufSize = UNDO_BUF_SIZE;
m_nSyncPosition = m_nUndoPosition = 0;
ASSERT (m_aUndoBuf.size () == 0);
bSuccess = TRUE;
// WinMerge has own routine for saving
#ifdef CRYSTALEDIT_ENABLESAVER
BOOL CCrystalTextBuffer::SaveToFile(LPCTSTR pszFileName,
- int nCrlfStyle /*= CRLF_STYLE_AUTOMATIC*/,
+ CRLFSTYLE nCrlfStyle /*= CRLF_STYLE_AUTOMATIC*/,
BOOL bClearModifiedFlag /*= TRUE*/)
{
ASSERT (nCrlfStyle == CRLF_STYLE_AUTOMATIC || nCrlfStyle == CRLF_STYLE_DOS ||
int nLineCount = m_aLines.size();
for (int nLine = 0; nLine < nLineCount; nLine++)
{
- int nLength = m_aLines[nLine].m_nLength;
+ int nLength = m_aLines[nLine].Length();
DWORD dwWrittenBytes;
if (nLength > 0)
{
- LPCTSTR pszLine = m_aLines[nLine].m_pcLine;
+ LPCTSTR pszLine = m_aLines[nLine].GetLine(0);
if (m_nSourceEncoding >= 0)
{
LPTSTR pszBuf;
- iconvert_new (m_aLines[nLine].m_pcLine, &pszBuf, 1, m_nSourceEncoding, m_nSourceEncoding == 15);
+ iconvert_new (m_aLines[nLine].GetLine(0), &pszBuf, 1, m_nSourceEncoding, m_nSourceEncoding == 15);
if (!::WriteFile (hTempFile, pszBuf, nLength, &dwWrittenBytes, NULL))
{
free (pszBuf);
CString &text, CRLFSTYLE nCrlfStyle /* CRLF_STYLE_AUTOMATIC */,
BOOL bExcludeInvisibleLines/*=TRUE*/) const
{
- LPCTSTR sEol = GetStringEol (nCrlfStyle);
- GetText(nStartLine, nStartChar, nEndLine, nEndChar, text, sEol, bExcludeInvisibleLines);
+ GetText(nStartLine, nStartChar, nEndLine, nEndChar, text, (nCrlfStyle == CRLF_STYLE_AUTOMATIC) ? NULL : GetStringEol (nCrlfStyle), bExcludeInvisibleLines);
}
// assert to be sure to catch these 'do nothing' cases.
ASSERT (nStartLine != nEndLine || nStartChar != nEndChar);
- if (pszCRLF == NULL)
- pszCRLF = crlf;
- int nCRLFLength = (int) _tcslen (pszCRLF);
- ASSERT (nCRLFLength > 0);
+ int nCRLFLength;
+ LPCTSTR pszCurCRLF;
int nBufSize = 0;
for (int L = nStartLine; L <= nEndLine; L++)
{
nBufSize += m_aLines[L].Length();
+ pszCurCRLF = pszCRLF ? pszCRLF : m_aLines[L].GetEol();
+ nCRLFLength = lstrlen(pszCurCRLF);
nBufSize += nCRLFLength;
}
memcpy (pszBuf, startLine.GetLine(nStartChar), sizeof (TCHAR) * nCount);
pszBuf += nCount;
}
- memcpy (pszBuf, pszCRLF, sizeof (TCHAR) * nCRLFLength);
+ pszCurCRLF = pszCRLF ? pszCRLF : startLine.GetEol();
+ nCRLFLength = lstrlen(pszCurCRLF);
+ memcpy (pszBuf, pszCurCRLF, sizeof (TCHAR) * nCRLFLength);
pszBuf += nCRLFLength;
for (int I = nStartLine + 1; I < nEndLine; I++)
{
memcpy (pszBuf, li.GetLine(), sizeof (TCHAR) * nCount);
pszBuf += nCount;
}
- memcpy (pszBuf, pszCRLF, sizeof (TCHAR) * nCRLFLength);
+ pszCurCRLF = pszCRLF ? pszCRLF : startLine.GetEol();
+ nCRLFLength = lstrlen(pszCurCRLF);
+ memcpy (pszBuf, pszCurCRLF, sizeof (TCHAR) * nCRLFLength);
pszBuf += nCRLFLength;
}
if (nEndChar > 0)
(apparent_ptEndPos.x <= m_aLines[apparent_ptEndPos.y].Length()))
{
GetTextWithoutEmptys (apparent_ptStartPos.y, apparent_ptStartPos.x, apparent_ptEndPos.y, apparent_ptEndPos.x, text, CRLF_STYLE_AUTOMATIC, FALSE);
- if (_tcscmp(text, ur.GetText()) == 0)
+ if (text.GetLength() == ur.GetTextLength() && memcmp(text, ur.GetText(), text.GetLength() * sizeof(TCHAR)) == 0)
{
VERIFY (InternalDeleteText (pSource, apparent_ptStartPos.y, apparent_ptStartPos.x, apparent_ptEndPos.y, apparent_ptEndPos.x));
ptCursorPos = apparent_ptStartPos;
#ifdef _ADVANCED_BUGCHECK
CString text;
GetTextWithoutEmptys (apparent_ptStartPos.y, apparent_ptStartPos.x, apparent_ptEndPos.y, apparent_ptEndPos.x, text, CRLF_STYLE_AUTOMATIC, FALSE);
- ASSERT (lstrcmp (text, ur.GetText ()) == 0);
+ ASSERT (text.GetLength() == ur.GetTextLength() && memcmp (text, ur.GetText (), text.GetLength() * sizeof(TCHAR)) == 0);
#endif
VERIFY(DeleteText(pSource, apparent_ptStartPos.y, apparent_ptStartPos.x,
apparent_ptEndPos.y, apparent_ptEndPos.x, 0, FALSE, FALSE));
// WinMerge has own routines for loading and saving
#ifdef CRYSTALEDIT_ENABLELOADER
- BOOL LoadFromFile (LPCTSTR pszFileName, int nCrlfStyle = CRLF_STYLE_AUTOMATIC);
+ BOOL LoadFromFile (LPCTSTR pszFileName, CRLFSTYLE nCrlfStyle = CRLF_STYLE_AUTOMATIC);
#endif
#ifdef CRYSTALEDIT_ENABLESAVER
- BOOL SaveToFile(LPCTSTR pszFileName, int nCrlfStyle = CRLF_STYLE_AUTOMATIC,
+ BOOL SaveToFile(LPCTSTR pszFileName, CRLFSTYLE nCrlfStyle = CRLF_STYLE_AUTOMATIC,
BOOL bClearModifiedFlag = TRUE);
#endif
ID_INDICATOR_ENCODING "Unicode"
END
+// EOL types shown in folder compare EOL type column and in file compare statusbar\r
+STRINGTABLE\r
+BEGIN\r
+ IDS_EOL_DOS "Win"\r
+ IDS_EOL_MAC "Mac"\r
+ IDS_EOL_UNIX "Unix"\r
+ IDS_EOL_MIXED "Mixed"\r
+ IDS_EOL_BIN "Binary"\r
+ IDS_EOL_LF "LF"\r
+ IDS_EOL_CR "CR"\r
+ IDS_EOL_CRLF "CRLF"\r
+ IDS_EOL_NONE "None"\r
+END\r
+
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#include "CCrystalTextBuffer.h"
#include "SyntaxColors.h"
-#include "OptionsMgr.h"
+#include "RegOptionsMgr.h"
class CSampleDoc : public CDocument
{
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I ".\Src" /I "." /I "..\..\Src\editlib" /I "..\..\Src\Common" /I "..\..\Src" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /D EDITPADC_CLASS= /D "CRYSTALEDIT_ENABLELOADER" /D "CRYSTALEDIT_ENABLESAVER" /Yu"stdafx.h" /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I ".\Src" /I "." /I "..\..\Src\editlib" /I "..\..\Src\Common" /I "..\..\Src" /I "..\..\Externals\pcre\Win32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /D EDITPADC_CLASS= /D "CRYSTALEDIT_ENABLELOADER" /D "CRYSTALEDIT_ENABLESAVER" /Yu"stdafx.h" /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
# ADD BASE RSC /l 0x419 /d "NDEBUG" /d "_AFXDLL"
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386
-# ADD LINK32 imm32.lib shlwapi.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\output"
+# ADD LINK32 imm32.lib shlwapi.lib ..\..\Build\pcre\minsizerel\pcre.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\output"
!ELSEIF "$(CFG)" == "SampleStatic - Win32 Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".\Src" /I "." /I "..\..\Src\editlib" /I "..\..\Src\Common" /I "..\..\Src" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /D EDITPADC_CLASS= /D "CRYSTALEDIT_ENABLELOADER" /D "CRYSTALEDIT_ENABLESAVER" /FR /Yu"stdafx.h" /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".\Src" /I "." /I "..\..\Src\editlib" /I "..\..\Src\Common" /I "..\..\Src" /I "..\..\Externals\pcre\Win32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /D EDITPADC_CLASS= /D "CRYSTALEDIT_ENABLELOADER" /D "CRYSTALEDIT_ENABLESAVER" /FR /Yu"stdafx.h" /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
# ADD BASE RSC /l 0x419 /d "_DEBUG" /d "_AFXDLL"
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 imm32.lib shlwapi.lib /nologo /subsystem:windows /profile /debug /machine:I386 /libpath:"..\output"
+# ADD LINK32 imm32.lib shlwapi.lib ..\..\Build\pcre\minsizerel\pcre.lib /nologo /subsystem:windows /profile /debug /machine:I386 /libpath:"..\output"
!ELSEIF "$(CFG)" == "SampleStatic - Win32 Unicode Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I ".\Src" /I "." /I "..\..\Src\editlib" /I "..\..\Src\Common" /I "..\..\Src" /D "NDEBUG" /D "_UNICODE" /D "WIN32" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /D EDITPADC_CLASS= /D "CRYSTALEDIT_ENABLELOADER" /D "CRYSTALEDIT_ENABLESAVER" /Yu"stdafx.h" /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I ".\Src" /I "." /I "..\..\Src\editlib" /I "..\..\Src\Common" /I "..\..\Src" /I "..\..\Externals\pcre\Win32" /D "NDEBUG" /D "_UNICODE" /D "WIN32" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /D EDITPADC_CLASS= /D "CRYSTALEDIT_ENABLELOADER" /D "CRYSTALEDIT_ENABLESAVER" /Yu"stdafx.h" /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
# ADD BASE RSC /l 0x419 /d "NDEBUG" /d "_AFXDLL"
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386 /out:"Release/crysedit_demo.exe"
-# ADD LINK32 imm32.lib shlwapi.lib /nologo /entry:"wWinMainCRTStartup" /subsystem:windows /machine:I386 /libpath:"..\output"
+# ADD LINK32 imm32.lib shlwapi.lib ..\..\Build\pcre\minsizerel\pcre.lib /nologo /entry:"wWinMainCRTStartup" /subsystem:windows /machine:I386 /libpath:"..\output"
!ELSEIF "$(CFG)" == "SampleStatic - Win32 Unicode Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /I "..\..\Src\editlib" /I "..\..\Src\Common" /I "..\..\Src" /D "_DEBUG" /D "_UNICODE" /D "WIN32" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /D EDITPADC_CLASS= /D "CRYSTALEDIT_ENABLELOADER" /D "CRYSTALEDIT_ENABLESAVER" /Yu"stdafx.h" /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /I "..\..\Src\editlib" /I "..\..\Src\Common" /I "..\..\Src" /I "..\..\Externals\pcre\Win32" /D "_DEBUG" /D "_UNICODE" /D "WIN32" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /D EDITPADC_CLASS= /D "CRYSTALEDIT_ENABLELOADER" /D "CRYSTALEDIT_ENABLESAVER" /Yu"stdafx.h" /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL"
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 imm32.lib shlwapi.lib /nologo /entry:"wWinMainCRTStartup" /subsystem:windows /debug /machine:I386 /pdbtype:sept /libpath:"..\output"
+# ADD LINK32 imm32.lib shlwapi.lib ..\..\Build\pcre\minsizerel\pcre.lib /nologo /entry:"wWinMainCRTStartup" /subsystem:windows /debug /machine:I386 /pdbtype:sept /libpath:"..\output"
!ENDIF
# End Source File
# Begin Source File
+SOURCE=..\..\Src\editlib\css.cpp
+# End Source File
+# Begin Source File
+
SOURCE=..\..\Src\editlib\dcl.cpp
# End Source File
# Begin Source File
# End Source File
# Begin Source File
+SOURCE=..\..\Src\editlib\LineInfo.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Src\editlib\LineInfo.h
+# End Source File
+# Begin Source File
+
SOURCE=..\..\Src\editlib\lisp.cpp
# End Source File
# Begin Source File
# End Source File
# Begin Source File
+SOURCE=..\..\Src\editlib\po.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Src\editlib\powershell.cpp
+# End Source File
+# Begin Source File
+
SOURCE=..\..\Src\editlib\python.cpp
# End Source File
# Begin Source File
# End Source File
# Begin Source File
+SOURCE=..\..\Src\editlib\UndoRecord.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Src\editlib\UndoRecord.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Src\editlib\verilog.cpp
+# End Source File
+# Begin Source File
+
SOURCE=..\..\Src\editlib\wispelld.h
# End Source File
# Begin Source File
# Begin Source File
SOURCE=..\..\Src\Common\OptionsMgr.cpp
+# SUBTRACT CPP /YX /Yc /Yu
# End Source File
# Begin Source File
# End Source File
# Begin Source File
+SOURCE=..\..\Src\Common\RegOptionsMgr.cpp
+# SUBTRACT CPP /YX /Yc /Yu
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Src\Common\RegOptionsMgr.h
+# End Source File
+# Begin Source File
+
SOURCE=..\..\Src\Common\SuperComboBox.cpp
# End Source File
# Begin Source File
# Begin Source File
SOURCE=..\..\Src\Common\varprop.cpp
+# SUBTRACT CPP /YX /Yc /Yu
# End Source File
# Begin Source File
#include "stdafx.h"
+
+/**
+ * @brief Load string resource and return as CString.
+ * @param [in] id Resource string ID.
+ * @return Resource string as CString.
+ */
+String LoadResString(UINT id)
+{
+ TCHAR szBuf[512];
+ LoadString(NULL, id, szBuf, sizeof(szBuf));
+ return String(szBuf);
+}
+
+/**
+ * @brief Wrapper around CMergeApp::TranslateDialog()
+ */
+void NTAPI LangTranslateDialog(HWND h)
+{
+}
+
+/**
+ * @brief Lang aware version of AfxFormatStrings()
+ */
+void NTAPI LangFormatStrings(CString &rString, UINT id, LPCTSTR const *rglpsz, int nString)
+{
+ String fmt = LoadResString(id);
+ AfxFormatStrings(rString, fmt.c_str(), rglpsz, nString);
+}
+
+/**
+ * @brief Lang aware version of AfxFormatString1()
+ */
+void NTAPI LangFormatString1(CString &rString, UINT id, LPCTSTR lpsz1)
+{
+ LangFormatStrings(rString, id, &lpsz1, 1);
+}
+
+// Make a CString from printf-style args (single call version of CString::Format)
+CString Fmt(LPCTSTR fmt, ...)
+{
+ CString str;
+ va_list args;
+ va_start(args, fmt);
+ str.FormatV(fmt, args);
+ va_end(args);
+ return str;
+}
+
+
#pragma warning(disable:4786)
#include "isx.h"
+
+#include "UnicodeString.h"
+
+ /** @brief Load string from string resources; shortcut for CString::LoadString */
+String LoadResString(UINT id);
+
+ /** @brief Wrapper around CMergeApp::TranslateDialog() */
+void NTAPI LangTranslateDialog(HWND);
+
+ /** @brief Lang aware version of AfxFormatString1() */
+void NTAPI LangFormatString1(CString &, UINT, LPCTSTR);
+
+ /** @brief Inline sprintf-style format; shortcut for CString::Format */
+CString Fmt(LPCTSTR fmt, ...);
+
+ /** @brief include for the custom dialog boxes, with do not ask/display again */
#include "MessageBoxDialog.h"
+
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#define IDS_MESSAGEBOX_DONT_ASK_AGAIN 9016
#define IDS_NUM_REPLACED 18032
#define IDS_EDIT_TEXT_NOT_FOUND 18033
+#define IDS_EOL_DOS 30400\r
+#define IDS_EOL_MAC 30401\r
+#define IDS_EOL_UNIX 30402\r
+#define IDS_EOL_MIXED 30403\r
+#define IDS_EOL_BIN 30404\r
+#define IDS_EOL_LF 30405\r
+#define IDS_EOL_CR 30406\r
+#define IDS_EOL_CRLF 30407\r
+#define IDS_EOL_NONE 30408\r
#define ID_EDIT_DISABLEBSATSOL 32796
#define ID_EDIT_DISABLEDRAGANDDROP 32797
#define ID_EDIT_FIND_PREVIOUS 32799
#define ID_VIEW_WORDWRAP 32824
+#define ID_EDIT_LOWERCASE 33185\r
+#define ID_EDIT_UPPERCASE 33186\r
#define ID_EDIT_INDICATOR_COL 37900
#define ID_INDICATOR_ENCODING 37905
#define IDS_OLE_INIT_FAILED 57608