[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[TSVN] [Patch] Updated: TMerge Unicode build

From: Norbert Unterberg <nepo_at_gmx.net>
Date: 2005-04-16 17:38:48 CEST

Norbert Unterberg schrieb:

Attached an updated patch that fixes two minor glitches in addition to
the unicode support:

* Line Diff Bar too small (some characters were clipped)
* Endings of lines with chinese characters were cut off

Norbert

Index: src/TortoiseMerge/BaseView.cpp
===================================================================
--- src/TortoiseMerge/BaseView.cpp (revision 3049)
+++ src/TortoiseMerge/BaseView.cpp (working copy)
@@ -1041,7 +1041,8 @@
                         else
                                 VERIFY(pDC->ExtTextOut(origin.x, origin.y, ETO_CLIPPED, &rc, line, nCount, NULL));
                 } // if (nWidth > 0)
- origin.x += GetCharWidth() * line.GetLength();
+
+ origin.x += pDC->GetTextExtent(line).cx;
         } // if (nLength > 0)
 
         // Draw whitespaces to the left of the text
Index: src/TortoiseMerge/LineDiffBar.cpp
===================================================================
--- src/TortoiseMerge/LineDiffBar.cpp (revision 3049)
+++ src/TortoiseMerge/LineDiffBar.cpp (working copy)
@@ -98,6 +98,14 @@
                         if ((m_pMainFrm->m_pwndBottomView)&&(!m_pMainFrm->m_pwndBottomView->IsHidden()))
                                 size.cy = 0;
                 } // if (m_pMainFrm)
+
+ if (size.cy > 0)
+ {
+ // Convert client to window sizes
+ CRect rc(CPoint(0, 0), size);
+ AdjustWindowRectEx(&rc, GetStyle(), FALSE, GetExStyle());
+ size = rc.Size();
+ }
         } // if (bStretch) // if not docked stretch to fit
         else
         {
Index: src/TortoiseMerge/WorkingFile.cpp
===================================================================
--- src/TortoiseMerge/WorkingFile.cpp (revision 3049)
+++ src/TortoiseMerge/WorkingFile.cpp (working copy)
@@ -68,7 +68,7 @@
 CString
 CWorkingFile::GetWindowName() const
 {
- CString sErrMsg = "";
+ CString sErrMsg = _T("");
         // TortoiseMerge allows non-existing files to be used in a merge
         // Inform the user (in a non-intrusive way) if a file is absent
         if (! this->Exists())
Index: src/TortoiseMerge/Patch.cpp
===================================================================
--- src/TortoiseMerge/Patch.cpp (revision 3049)
+++ src/TortoiseMerge/Patch.cpp (working copy)
@@ -440,7 +440,20 @@
                         {
                                 if (PatchLines.GetUnicodeType()==CFileTextLines::UTF8)
                                 {
+#ifdef UNICODE
+ // convert the UTF-8 contents in CString sPatchLine into a CStringA
+ CStringA sPatchLineA;
+ char *pszPatchLine = sPatchLineA.GetBuffer(sPatchLine.GetLength());
+ for (int k = 0; k < sPatchLine.GetLength(); ++k)
+ {
+ *pszPatchLine++ = (char)sPatchLine.GetAt(k);
+ }
+ *pszPatchLine = 0;
+ sPatchLineA.ReleaseBuffer();
+ sPatchLine = CUnicodeUtils::GetUnicode(sPatchLineA);
+#else
                                         sPatchLine = CUnicodeUtils::GetUnicode(sPatchLine);
+#endif
                                 }
                         }
                         int nPatchState = (int)chunk->arLinesStates.GetAt(j);
Index: src/TortoiseMerge/DiffData.cpp
===================================================================
--- src/TortoiseMerge/DiffData.cpp (revision 3049)
+++ src/TortoiseMerge/DiffData.cpp (working copy)
@@ -152,7 +152,7 @@
 
 BOOL CDiffData::Load()
 {
- CStringA sConvertedBaseFilename, sConvertedTheirFilename, sConvertedYourFilename;
+ CString sConvertedBaseFilename, sConvertedTheirFilename, sConvertedYourFilename;
         apr_pool_t * pool;
 
         apr_pool_create_ex (&pool, NULL, abort_on_pool_failure, NULL);
@@ -266,10 +266,13 @@
 bool
 CDiffData::DoTwoWayDiff(const CString& sBaseFilename, const CString& sYourFilename, DWORD dwIgnoreWS, apr_pool_t * pool)
 {
+ CStringA strBaseFilename(sBaseFilename);
+ CStringA strYourFilename(sYourFilename);
+
         svn_diff_t * diffYourBase = NULL;
         svn_error_t * svnerr = NULL;
 
- svnerr = svn_diff_file_diff(&diffYourBase, sBaseFilename, sYourFilename, pool);
+ svnerr = svn_diff_file_diff(&diffYourBase, strBaseFilename, strYourFilename, pool);
         if (svnerr)
         {
                 TRACE(_T("diff-error in CDiffData::Load()\n"));
@@ -462,8 +465,11 @@
 bool
 CDiffData::DoThreeWayDiff(const CString& sBaseFilename, const CString& sYourFilename, const CString& sTheirFilename, apr_pool_t * pool)
 {
+ CStringA strBaseFilename(sBaseFilename);
+ CStringA strYourFilename(sYourFilename);
+ CStringA strTheirFilename(sTheirFilename);
         svn_diff_t * diffTheirYourBase = NULL;
- svn_error_t * svnerr = svn_diff_file_diff3(&diffTheirYourBase, sBaseFilename, sTheirFilename, sYourFilename, pool);
+ svn_error_t * svnerr = svn_diff_file_diff3(&diffTheirYourBase, strBaseFilename, strTheirFilename, strYourFilename, pool);
         if (svnerr)
         {
                 TRACE(_T("diff-error in CDiffData::Load()\n"));
Index: src/TortoiseMerge/TortoiseMerge.vcproj
===================================================================
--- src/TortoiseMerge/TortoiseMerge.vcproj (revision 3049)
+++ src/TortoiseMerge/TortoiseMerge.vcproj (working copy)
@@ -17,7 +17,7 @@
                         IntermediateDirectory="..\..\obj\TortoiseMerge\Debug"
                         ConfigurationType="1"
                         UseOfMFC="2"
- CharacterSet="2">
+ CharacterSet="1">
                         <Tool
                                 Name="VCCLCompilerTool"
                                 Optimization="0"
@@ -71,7 +71,7 @@
                         IntermediateDirectory="..\..\obj\TortoiseMerge\Release"
                         ConfigurationType="1"
                         UseOfMFC="2"
- CharacterSet="2"
+ CharacterSet="1"
                         WholeProgramOptimization="TRUE">
                         <Tool
                                 Name="VCCLCompilerTool"

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tortoisesvn.tigris.org
For additional commands, e-mail: dev-help@tortoisesvn.tigris.org
Received on Sat Apr 16 17:39:55 2005

This is an archived mail posted to the TortoiseSVN Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.